Skip to content

Instantly share code, notes, and snippets.

View gilou's full-sized avatar
🏠
Working from home

Gilles Pietri gilou

🏠
Working from home
View GitHub Profile
@gilou
gilou / norepeat.liq
Created May 24, 2021 20:39
Liquidsoap function to avoid repetitions of tracks based on the filename
# Compare two pairs, according to snd value
def compare_snd(a, b)
if snd(a) == snd(b) then
0
else
if snd(a) > snd(b) then
1
else
-1
end
@gilou
gilou / ipfo.yaml
Last active March 25, 2021 05:04
netplan ip failover OVH
routes:
- to: 0.0.0.0/0
via: GW_IPV4
on-link: true
- to: IPV6_RAN:GEff:ff:ff:ff:ff
scope: link
- to: ::/0
via: IPV6_RAN:GEff:ff:ff:ff:ff
on-link: true
@gilou
gilou / Dockerfile
Last active November 7, 2018 22:57
Dockerfile arch systemd
FROM base/archlinux:latest
RUN \
# First, update everything (start by keyring and pacman)
pacman -Sy && \
pacman -S archlinux-keyring --noconfirm --noprogressbar --quiet && \
pacman -S pacman --noconfirm --noprogressbar --quiet && \
pacman-db-upgrade && \
pacman -Su --noconfirm --noprogressbar --quiet && \
@gilou
gilou / test.liq
Created August 17, 2018 08:04
Liquidsoap script for a simple webradio
socket = "/home/ubuntu/demo/liq.sock"
logfile = "/home/ubuntu/demo/liq.log"
set("log.level", 4)
set("log.file.path", logfile)
# Print log messages to the console,
# can also be done by passing the -v option to liquidsoap.
set("log.stdout", log_stdout)
# Use the telnet server for requests
@gilou
gilou / check.liq
Created April 7, 2018 04:59
Playlist check function used with the logs in Liquidsoap
set("log.file.path", "/tmp/test.log")
set("server.socket.path","/tmp/<script>.sock")
set("server.socket",true)
# Simple check function to match any "Finished with ...." line in the logs
def checker(n)
# get info from upcoming request
m = request.metadata(n)
# command to find if the file was played according to the log
command = 'grep -F'
for vm in $(qm list | awk '/running/ { print $1 }' ) ; do qm set $vm -description "IPs détectées ($(date))$(qm agent $vm network-get-interfaces |jq '.[]|."ip-addresses"[]|."ip-address"' | grep -ve '127\.0\.0\.1\|::1\|fe80::' | sed 's/"//g')"; done

Keybase proof

I hereby claim:

  • I am gilou on github.
  • I am gilou (https://keybase.io/gilou) on keybase.
  • I have a public key ASBfDNMVlRcNCtmtGYG818VCNx7z5V7CgPtfr1M-FAYIFgo

To claim this, I am signing this object:

@gilou
gilou / remove_vbox_snapshots.sh
Created July 17, 2017 08:47
Originally oneliner to clean up snapshots in reverse order on a VirtualBox machine.
VM_NAME="MyVM"
# Use tac to reverse list given by --machinereadble outut of VBoxManage.
# Get ID from the SnapshotUUID-1-1-1-1-1-1="76c627e3-1c0a-4d0c-b680-b4f1c6175dac" output
for snap in $(VBoxManage snapshot "$VM_NAME" list --machinereadable| grep '^SnapshotUUID' | tac - | sed 's/SnapshotUUID\(-[0-9-]\+\)\?="\([0-9a-f-]\+\)"/\2/g') ; do
echo "Deleting Snap $snap" ; VBoxManage snapshot "$VM_NAME" delete "$snap"
done
@gilou
gilou / FakerDataGenerator.java
Created April 26, 2017 15:52
Talend routines to make use of Faker java lib
package routines;
import java.util.Locale;
import com.github.javafaker.Faker;
/*
* user specification: the function's comment should contain keys as follows: 1. write about the function's comment.but
* it must be before the "{talendTypes}" key.
*
* 2. {talendTypes} 's value must be talend Type, it is required . its value should be one of: String, char | Character,
server 10.8.0.0 255.255.255.0
# Reseau 1
route 192.168.1.0 255.255.255.0
push "route 192.168.1.0 255.255.255.0"
# Reseau 2
route 192.168.2.0 255.255.255.0
push "route 192.168.2.0 255.255.255.0"
#conf / client dans ccd
client-config-dir ccd