Skip to content

Instantly share code, notes, and snippets.

Avatar
🏡
Working from home

Hervé Beraud 4383

🏡
Working from home
View GitHub Profile
@4383
4383 / gist:570ca024e140d4a2b5a7be4ca664594e
Last active Oct 4, 2016
[Checklist] Prepare a pentest camp (challenge)
View gist:570ca024e140d4a2b5a7be4ca664594e
@4383
4383 / change-git-author-informations-in-project-history.sh
Created Oct 14, 2016
Change git commit author in project history
View change-git-author-informations-in-project-history.sh
#!/bin/bash
git filter-branch --commit-filter '
if [ "$GIT_AUTHOR_NAME" = "Herve BERAUD" ];
then
GIT_AUTHOR_NAME="Hervé BERAUD";
GIT_AUTHOR_EMAIL="herveberaud.pro@gmail.com";
git commit-tree "$@";
if [ "$GIT_AUTHOR_EMAIL" = "herve.beraud@openmailbox.org" ];
then
GIT_AUTHOR_NAME="Hervé BERAUD";
@4383
4383 / parsers.py
Last active Oct 21, 2016
A pure python command line parser
View parsers.py
# -*- coding: UTF-8 -*-
import argparse
import os
from const import BASE_PATH
from const import VERSION
def sample():
pass
@4383
4383 / tee.py
Created Jun 27, 2017
python stdout handling like linux command tee
View tee.py
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 Sep 12, 2017
README updated with git flow branch changing
View gist:bd9b0ac96824bb10756d73ee194e96a9
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 / merge-request-workflow.md
Created Oct 12, 2017
Pull request / Merge request workflow
View merge-request-workflow.md

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.

@4383
4383 / commiters-merge-request.md
Last active Oct 12, 2017
[commiters] Merge properly a PR for a linear history without merge commit
View commiters-merge-request.md

consider an upstream project based on git@github.com:fake-group/fake-project.git

$ git clone git@github.com:fake-group/fake-project.git
$ cd fake-project

show history before

$ git log
commit dbb2b36dc57ac84fb05d6a601dac35f5caf813af
Author: Hervé Beraud <herveberaud.pro@gmail.com>
View gist:3e092082e945632dded9f59050a2643d
Apply this checklist on release candidate
[ ] create release branch
[ ] bump version
[ ] apply fix (if exist)
@4383
4383 / client.py
Last active Jan 16, 2018
asyncio - shared socket between coroutines
View client.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import asyncio
async def init_socket (loop):
reader, writer = await asyncio.open_connection('127.0.0.1', 3000, loop=loop)
return reader, writer
@4383
4383 / urlminifier.py
Created Mar 29, 2018
Minify url algorithme with python
View urlminifier.py
import random
choices = range(48, 57)
choices.extend(range(65, 90))
choices.extend(range(97, 122))
chr_identifier = ""
int_identifier = ""
for el in range(0, 6):
chr_identifier += chr(random.choice(choices))
int_identifier += str(random.choice(choices))
print(chr_identifier)
You can’t perform that action at this time.