Skip to content

Instantly share code, notes, and snippets.

View milouse's full-sized avatar

Étienne Deparis milouse

View GitHub Profile
@milouse
milouse / unshorten.php
Last active October 10, 2019 13:41
Small script intended to expand short URL passed as a GET parameter.
<?php
/**
* DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
* Version 2, December 2004
*
* Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
*
* Everyone is permitted to copy and distribute verbatim or modified
* copies of this license document, and changing it is allowed as long
* as the name is changed.
@milouse
milouse / migrate_key.sh
Created August 31, 2017 08:17
A quick script to decypher and reencrypt all the content of a password-store repository when you want to add or change your gpg keys
#!/usr/bin/env bash
[ ! -n "$1" ] && echo "You must provide the new key id" && exit 1
recipient_chain=
for recip in $@; do
recipient_chain+="-r $recip "
done
for gpgfile in `find . -type f -name *.gpg`; do
#!/usr/bin/env bash
cat <<EOF > list_input.rb
require 'yaml'
cur_dir = File.expand_path(File.dirname(__FILE__))
chapters = YAML.safe_load(IO.read(cur_dir + '/_data/chapters.yml'))
puts "#{cur_dir}/license.md\n#{cur_dir}/authors.md"
@milouse
milouse / soffice.service
Created December 21, 2016 17:52
Headless LibreOffice systemd service file
[Unit]
Description=Control headless soffice instance
After=network.target xvfb.service
Requires=xvfb.service
[Service]
Type=simple
ExecStart=/opt/libreoffice4.4/program/soffice --headless \
--accept=socket,host=127.0.0.1,port=8101;urp; --display :5.0 \
--pidfile=/var/run/soffice.pid --nologo --nodefault --nofirststartwizard
@milouse
milouse / fossil_to_git.sh
Created December 21, 2016 17:48
Shell script to create (and update) a git mirror of a fossil repository
#!/usr/bin/env bash
# This script should be called from a bare git repository
# $1 should contain the path to the fossil file to export
[ -z "$1" ] && exit 1
[ -f tmp_export_file ] && rm tmp_export_file
fossil export --git "$1" > tmp_export_file
@milouse
milouse / dl_latest_tor_browser.sh
Created December 21, 2016 10:22
Shell function to download the last torbrowser version
dl_latest_tor_browser() {
OLD_PWD=$(pwd)
LAST_VER=$(\curl -s 'https://www.torproject.org/projects/torbrowser.html.en' | sed -n "s|^.*\.\./dist/torbrowser/\([0-9]\.[0-9]\.[0-9]\)/tor-browser-linux64-\([0-9]\.[0-9]\.[0-9]\)_fr\.tar\.xz\".*$|\1|p")
if [ ! -n "$LAST_VER" ]; then
LAST_VER=$(\curl -s 'https://www.torproject.org/projects/torbrowser.html.en' | sed -n "s|^.*\.\./dist/torbrowser/\([0-9]\.[0-9]\)/tor-browser-linux64-\([0-9]\.[0-9]\)_fr\.tar\.xz\".*$|\1|p")
fi
cd "$HOME/Téléchargements"
if [ -d 'tor-browser_fr' ]; then
CUR_VER=$(sed -n 1p tor-browser_fr/Browser/TorBrowser/Docs/ChangeLog.txt | sed -n "s/^Tor Browser \(.*\) -- .*$/\1/p")
if [ "$LAST_VER" = "$CUR_VER" ]; then

Keybase proof

I hereby claim:

  • I am milouse on github.
  • I am milouse (https://keybase.io/milouse) on keybase.
  • I have a public key whose fingerprint is 2EBD 3E94 57B6 316D BD10 0ABC A714 ECAC 8C9C EE3D

To claim this, I am signing this object: