Skip to content

Instantly share code, notes, and snippets.

Avatar

Laurent Coustet zehome

View GitHub Profile
View gist:8dbdc7882732f57b4eaf725b7286f6ae
#!/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 Mar 23, 2019
leslie radar using arduino
View radar.c
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 Feb 14, 2019
rss limiter (bash / linux)
View rsslimiter.sh
#!/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 Dec 18, 2018
Run old firefox from docker
View singleline_docker_old_firefox.sh
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 Dec 26, 2016
Upgrading source installation of gitlab in one script
View gitlab_upgrade.sh
#!/bin/bash
set -e
version="v8.15.1"
systemctl stop gitlab
cd /home/git/gitlab
echo Stash
@zehome
zehome / upgrade_openbsd60.yml
Created Sep 19, 2016
Upgrade to OpenBSD 6.0 using ansible
View upgrade_openbsd60.yml
---
- 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
mlvpn updown.sh for linux without tunnel ip address required
View mlvpn_updown.sh
#!/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 Jun 29, 2016
Dirty incomplete upgrade OpenBSD 5.8 to 5.9 using ansible 2
View upgrade_openbsd58_openbsd59.yml
---
- 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
View gist:6b8d4ae596bc216f2a56
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 Dec 21, 2015
Enable cross request for graphite/gunicorn
View cross_request_origin_graphite.md

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