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 / 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 / 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
curl https://herve.beraud.io/ 2>/dev/null | sed -n '/d/s/.*name="description"\s\+content="\([^"]\+\).*/\1/p'
@4383
4383 / gist:a753084cd8289c50ceaf497c6bfd0fda
Created March 28, 2018 14:15
Vim - comment lines between num1 and num2
:34,65 s/./#&/
@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 / 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 / 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 / file.json
Created April 30, 2018 16:57
JSON file sample for niet testing purpose
{
"project": {
"meta": {
"name": "my-project"
}
},
"foo": "bar",
"list-items": [
"item1",
"item2",
@4383
4383 / README-Template.md
Created May 2, 2018 13:54 — forked from PurpleBooth/README-Template.md
A template to make good README.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 13:12
Git rebase the root commit
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