Skip to content

Instantly share code, notes, and snippets.

Avatar
🏡
Working from home

Hervé Beraud 4383

🏡
Working from home
View GitHub Profile
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
View gist:6082fefb1440eb200298e30db5a21013
curl https://herve.beraud.io/ 2>/dev/null | sed -n '/d/s/.*name="description"\s\+content="\([^"]\+\).*/\1/p'
@4383
4383 / enumerate_interfaces.py
Last active Jun 26, 2018 — forked from pklaus/enumerate_interfaces.py
Python: List all Network Interfaces On Computer
View enumerate_interfaces.py
# 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 / 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)
@4383
4383 / file.yaml
Created Apr 30, 2018
YAML file sample for niet testing purpose
View file.yaml
# /path/to/your/file.yaml
project:
meta:
name: my-project
foo: bar
list-items:
- item1
- item2
- item3
@4383
4383 / file.json
Created Apr 30, 2018
JSON file sample for niet testing purpose
View file.json
{
"project": {
"meta": {
"name": "my-project"
}
},
"foo": "bar",
"list-items": [
"item1",
"item2",
@4383
4383 / README-Template.md
Created May 2, 2018 — forked from PurpleBooth/README-Template.md
A template to make good README.md
View README-Template.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@4383
4383 / git.sh
Last active May 4, 2018
Git rebase the root commit
View git.sh
git rebase -i --root
# edit on the root commit
git commit --amend --no-edit # per example
# or change the commit date
git commit --amend --date="Wed Feb 16 14:00 2011 +0100"
# or change the commit author
git commit --amend --author="Hervé Beraud"
git rebase --continue