Skip to content

Instantly share code, notes, and snippets.

View 4383's full-sized avatar
🏠
Working from home

Hervé Beraud 4383

🏠
Working from home
View GitHub Profile
@4383
4383 / convert.py
Last active November 23, 2020 14:57
Python ROT13 converter / deconverter
import string #fixed typo was using
text = str(input('tip your text to convert: ', ))
rot13 = string.maketrans(
"ABCDEFGHIJKLMabcdefghijklmNOPQRSTUVWXYZnopqrstuvwxyz",
"NOPQRSTUVWXYZnopqrstuvwxyzABCDEFGHIJKLMabcdefghijklm")
string.translate(text, rot13)
# Example
# 'Hello World!
# 'Uryyb Jbeyq!
@4383
4383 / gist:570ca024e140d4a2b5a7be4ca664594e
Last active October 4, 2016 11:15
[Checklist] Prepare a pentest camp (challenge)
@4383
4383 / change-git-author-informations-in-project-history.sh
Created October 14, 2016 09:02
Change git commit author in project history
#!/bin/bash
git filter-branch --commit-filter '
if [ "$GIT_AUTHOR_NAME" = "Herve BERAUD" ];
then
GIT_AUTHOR_NAME="Hervé BERAUD";
GIT_AUTHOR_EMAIL="[email protected]";
git commit-tree "$@";
if [ "$GIT_AUTHOR_EMAIL" = "[email protected]" ];
then
GIT_AUTHOR_NAME="Hervé BERAUD";
@4383
4383 / parsers.py
Last active October 21, 2016 07:31
A pure python command line parser
# -*- coding: UTF-8 -*-
import argparse
import os
from const import BASE_PATH
from const import VERSION
def sample():
pass
@4383
4383 / keybase.md
Last active November 5, 2018 08:43
keybase.md

Keybase proof

I hereby claim:

  • I am 4383 on github.
  • I am 4383 (https://keybase.io/4383) on keybase.
  • I have a public key whose fingerprint is 0695 6466 CF91 B28D EEB4 554F 07C1 7441 3641 8D7A

To claim this, I am signing this object:

@4383
4383 / google-bookmarks-to-markdown-format.py
Created December 2, 2016 15:33
Export manualy your google bookmarks and transform it to markdown format for hosting and versioning on github (quick and dirty)
# First export manualy your google bookmarks in place exported file in the same directory of this script
# After launch this script (python google-bookmarks-to-markdown-format.py) and have fun !
def run():
output = []
with open('GoogleBookmarks.html') as export:
html = export.readlines()
for line in html:
if 'H3' in line:
output.append('## {0}'.format(line[36:-6].capitalize()))
if 'A HREF' in line:
@4383
4383 / tee.py
Created June 27, 2017 13:58
python stdout handling like linux command tee
import subprocess, os, sys
# Unbuffer output
sys.stdout = os.fdopen(sys.stdout.fileno(), 'w', 0)
tee = subprocess.Popen(["tee", "log.txt"], stdin=subprocess.PIPE)
os.dup2(tee.stdin.fileno(), sys.stdout.fileno())
os.dup2(tee.stdin.fileno(), sys.stderr.fileno())
@4383
4383 / gist:bd9b0ac96824bb10756d73ee194e96a9
Created September 12, 2017 15:13
README updated with git flow branch changing
branch=$(git symbolic-ref HEAD 2>/dev/null | sed "s@refs/heads/@@")
sed -i "/\(build status\|documentation\)/{s@\(badges\|commits\|docs.ecocenter.fr/[^/]*\)/[^/]*\([^)]*)\)@\1/$branch\2@g}" $ROOTDIR/README.md
@4383
4383 / commiters-merge-request.md
Last active October 12, 2017 14:18
[commiters] Merge properly a PR for a linear history without merge commit

consider an upstream project based on [email protected]:fake-group/fake-project.git

$ git clone [email protected]:fake-group/fake-project.git
$ cd fake-project

show history before

$ git log
commit dbb2b36dc57ac84fb05d6a601dac35f5caf813af
Author: Hervé Beraud <[email protected]>
@4383
4383 / merge-request-workflow.md
Created October 12, 2017 14:17
Pull request / Merge request workflow

Your feature or fix are currently done in your fork you must create a merge request on the upstream project for spreed your changes to others contributors.

In gitlab GUI open your fork (normaly in your namespace), if you've pushed your branch into your fork repository a new button has available in the GUI create merge request, so click on!

The page loading a new merging form, you must fill it! At start you must select the king of merge request in the selectbox available (example: doc/fix/feat) and respond to asked questions.