Skip to content

Instantly share code, notes, and snippets.

View 4383's full-sized avatar
🏠
using a computer

Hervé Beraud 4383

🏠
using a computer
View GitHub Profile
@4383
4383 / file.yaml
Created April 30, 2018 16:54
YAML file sample for niet testing purpose
# /path/to/your/file.yaml
project:
meta:
name: my-project
foo: bar
list-items:
- item1
- item2
- item3
@4383
4383 / urlminifier.py
Created March 29, 2018 12:38
Minify url algorithme with python
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)
@4383
4383 / enumerate_interfaces.py
Last active June 26, 2018 12:25 — forked from pklaus/enumerate_interfaces.py
Python: List all Network Interfaces On Computer
# Use those functions to enumerate all interfaces available on the system using Python.
# found on <http://code.activestate.com/recipes/439093/#c1>
import socket
import fcntl
import struct
import array
def all_interfaces():
max_possible = 128 # arbitrary. raise if needed.
@4383
4383 / gist:a753084cd8289c50ceaf497c6bfd0fda
Created March 28, 2018 14:15
Vim - comment lines between num1 and num2
:34,65 s/./#&/
curl https://herve.beraud.io/ 2>/dev/null | sed -n '/d/s/.*name="description"\s\+content="\([^"]\+\).*/\1/p'
@4383
4383 / client.py
Last active September 29, 2021 15:03
asyncio - shared socket between coroutines
#!/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 / gist:3e092082e945632dded9f59050a2643d
Created October 13, 2017 09:32
checklist release-candidate
Apply this checklist on release candidate
[ ] create release branch
[ ] bump version
[ ] apply fix (if exist)
@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.

@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 / 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