Skip to content

Instantly share code, notes, and snippets.

View superboum's full-sized avatar

Quentin Dufour superboum

View GitHub Profile
#!/usr/bin/python3
# pip3 install cloudflare requests
import requests, time, re, CloudFlare
cf = CloudFlare.CloudFlare(email='xxxxx', token='xxxxxxxx')
providers = ['http://monip.org', 'http://checkip.dyndns.org/']
sel_zone = "example.tld"
sel_record = "dirk.machine.example.tld"
delay = 120
# WILL FAIL with RecursionError: maximum recursion depth exceeded
def x(a):
y(a - 1)
def y(a):
if a > 0:
x(a)
else:
print("done")
@superboum
superboum / ddclient.conf
Last active September 10, 2018 20:46
DDCLIENT
###
# DDCLIENT : https://www.cloudflare.com/technical-resources/#ddclient
###
# /etc/ddclient/ddclient.conf
daemon=600 # check every 600 seconds
syslog=yes # log update msgs to syslog
mail=root # mail all msgs to root
mail-failure=root # mail failed update msgs to root
pid=/var/run/ddclient.pid # record PID in file.
@superboum
superboum / update-kernel
Last active May 15, 2018 19:51
Boot Linux EFI without intermediate bootloader
#!/usr/bin/bash
# How to add a UEFI entry
# efibootmgr \
# --disk /dev/sda \
# --create \
# --label 'Choisis moi' \
# --loader '\EFI\efistub\vmlinuz' \
# --unicode 'root=UUID=50200856-c21a-4bea-9412-bd2f7b27b8b5 ro rootflags=subvol=root rhgb quiet initrd=\EFI\efistub\initramfs' \
# --verbose
@superboum
superboum / camdelay.pde
Created April 2, 2018 11:36
Camera Delay Processing
import processing.video.*;
int delay = 3;
int square_size = 5;
Capture cam;
ArrayList<PImage> frames = new ArrayList();
void setup() {
size(640, 480);
@superboum
superboum / server.py
Created November 7, 2017 21:06
Webserver that generates files of 100MB on the fly
# run with FLASK_APP=server.py flask run
# download your file on http://127.0.0.1:5000/random
from flask import Flask
from flask import Response
import os
app = Flask(__name__)
@app.route('/random')
def gen_random():
@superboum
superboum / sms.py
Created November 6, 2017 19:07
Python script to easily send messages to your phone via the Free Mobile API
#!/usr/bin/python3
import requests, sys
payload = {
'user': sys.argv[1],
'pass': sys.argv[2],
'msg': sys.stdin.read()
}
r = requests.get("https://smsapi.free-mobile.fr/sendmsg", params=payload)
@superboum
superboum / weather.pde
Last active November 5, 2017 15:54
Yahoo Weather API with YQL + Processing + Unirest
import com.mashape.unirest.http.*;
/* API Documentation :
* https://developer.yahoo.com/weather/#curl
* Click on "Current conditions for San Diego, CA" to have a similar requests.
* Conditions code can be found here: https://developer.yahoo.com/weather/documentation.html#codes (eg: 0 = tornado)
* You must create a folder named "code" in your sketch directory and put unirest.jar inside
*/
void setup() {
try {
float vit=1;
int taille =50;
PVector[] squares;
void setup() {
size(600, 600);
squares = new PVector[] {
new PVector(0,0),
new PVector(taille,taille),
@superboum
superboum / reader.pde
Created October 8, 2017 14:26
Some processing snippets
void setup() {
BufferedReader reader;
reader = createReader("euler.txt");
ArrayList<Integer> nombres = new ArrayList<Integer>();
while (true) {
try {
int lu = reader.read();
if (lu == -1) {
break;
} else {