Skip to content

Instantly share code, notes, and snippets.

View zehome's full-sized avatar

Laurent Coustet zehome

View GitHub Profile
#!/usr/bin/env python3
import asyncio
async def main():
reader, writer = await asyncio.open_connection('localhost', 5556)
if crash:
pass
asyncio.run(main(), debug=True)
@zehome
zehome / radar.c
Last active March 23, 2019 20:03
leslie radar using arduino
const int pwPin = 7;
const int led = 11;
void setup()
{
Serial.begin(115200);
pinMode(pwPin, INPUT);
pinMode(led, OUTPUT);
}
@zehome
zehome / rsslimiter.sh
Last active February 14, 2019 10:23
rss limiter (bash / linux)
#!/bin/bash
CGROUP_ROOT="/sys/fs/cgroup"
CGROUP_NAME="rsslimiter"
# CGROUP_CPUSHARES="512"
# CGROUP_BLKIO_THROTTLE_READ_BPS="8:0 $((100*1024*1024)),8:16 $((100*1024*1024))"
CGROUP_MAXMEM="$((32 * 1024 * 1024))" # in bytes
cgroup_init()
@zehome
zehome / singleline_docker_old_firefox.sh
Last active December 18, 2018 09:40
Run old firefox from docker
outd=$(mktemp -d); echo -e "FROM ubuntu:trusty\nRUN apt-get update && \
apt-get -qqy install firefox icedtea-netx\nRUN adduser --system --shell /bin/bash --uid $UID --disabled-password xuser\nUSER xuser" >$outd/Dockerfile && \
docker build -t oldfirefox $outd && rm $outd/Dockerfile && rm -r $outd && \
docker run -it --rm -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix oldfirefox
@zehome
zehome / gitlab_upgrade.sh
Created December 26, 2016 16:35
Upgrading source installation of gitlab in one script
#!/bin/bash
set -e
version="v8.15.1"
systemctl stop gitlab
cd /home/git/gitlab
echo Stash
@zehome
zehome / upgrade_openbsd60.yml
Created September 19, 2016 07:48
Upgrade to OpenBSD 6.0 using ansible
---
- hosts: all
gather_facts: yes
vars:
mirror: http://ftp.fr.openbsd.org/pub/OpenBSD
release: 6.0
arch: amd64
files:
- SHA256
- SHA256.sig
@zehome
zehome / mlvpn_updown.sh
Created May 25, 2016 14:39
mlvpn updown.sh for linux without tunnel ip address required
#!/bin/sh
# up/down script for MLVPN.
#
# MLVPN calls this script with at least 2 arguments:
# $1 : interface name
# $2 : "command"
# command can be:
# - "tuntap_up"
# - "tuntap_down"
@zehome
zehome / upgrade_openbsd58_openbsd59.yml
Last active June 29, 2016 12:14
Dirty incomplete upgrade OpenBSD 5.8 to 5.9 using ansible 2
---
- hosts: all
gather_facts: yes
vars:
mirror: http://ftp.eu.openbsd.org/pub/OpenBSD
release: 5.9
arch: amd64
tasks:
- name: installboot on sd0
command: installboot -v sd0
settings = {
core = {
real_name = "xx";
user_name = "xx";
nick = "xx";
recode_out_default_charset = "ISO-8859-15";
recode_autodetect_utf8 = "Yes";
recode_transliterate = "Yes";
};
"fe-text" = { actlist_sort = "refnum"; };
@zehome
zehome / cross_request_origin_graphite.md
Last active December 21, 2015 17:29
Enable cross request for graphite/gunicorn

Create this file in your graphite installation directory: lib/python2.7/site-packages/graphite/crossmiddleware.py

import re
 
from django.utils.text import compress_string
from django.utils.cache import patch_vary_headers
 
from django import http