Skip to content

Instantly share code, notes, and snippets.

Avatar

aeris aeris

View GitHub Profile
@aeris
aeris / uncommitted
Created Oct 11, 2017
Detect uncommitted git changes
View uncommitted
#!/usr/bin/env ruby
require 'find'
require 'open3'
require 'optparse'
require 'ostruct'
options = OpenStruct.new
OptionParser.new do |opts|
opts.on('-u', '--[no-]untrack', 'Include untracked files') { |v| options.untrack = v }
end.parse!
@aeris
aeris / pinentry-kwallet
Created Sep 29, 2017
pinentry proxy between kwallet and pinentry-qt
View pinentry-kwallet
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# AGPLv3 license
import dbus, logging, os, re, subprocess, sys, threading
LOGGER = logging.getLogger("kwallet")
hdlr = logging.FileHandler("/tmp/pinentry-kwallet.log")
formatter = logging.Formatter("%(levelname)s %(message)s")
hdlr.setFormatter(formatter)
#LOGGER.addHandler(hdlr)
@aeris
aeris / chaturbate.sh
Created Aug 28, 2017
Chaturbate recorder
View chaturbate.sh
#!/bin/sh
URL="${2}"
NAME="$(echo "${URL}" | sed 's#.*/\([^/]*\)/$#\1#')"
pgrep -f "/${NAME}-.*/playlist.m3u8" && exit
STREAM="$(curl -s "${URL}" | grep hlsSourceFast | sed -n 's#.*\(https://.*/playlist.m3u8\).*#\1#p')"
ROOT_DIR=$HOME/x
case "${1}" in
vlc|v)
@aeris
aeris / concat
Created Jul 3, 2017
Montage vidéo pour PSES & Ubuntu Party
View concat
#!/usr/bin/env ruby
require 'tempfile'
require 'open3'
class Args
def initialize
@args = []
end
def <<(args)
@aeris
aeris / remark2pdf.js
Created Jun 3, 2017
Export your remarkjs slides to PDF (require phantomjs and imagemagick)
View remark2pdf.js
// Licence : AGPLv3+
"use strict";
var page = require('webpage').create(),
system = require('system'),
address, output, size, pageWidth, pageHeight;
String.prototype.padLeft = function (length, character) {
return new Array(length - this.length + 1).join(character || '0') + this;
}
@aeris
aeris / lxc-backup
Created Jan 10, 2017
LXC management
View lxc-backup
#!/usr/bin/env python
# License : AGPLv3+
import subprocess
import logging
import re
import os.path
import tempfile
from datetime import date, datetime, timedelta
import shutil
@aeris
aeris / randomize.rb
Last active Mar 20, 2019
Fast (>100MBps) CSPRNG to randomize hard drive before encryption
View randomize.rb
#!/usr/bin/env ruby
require 'openssl'
BLOCK_SIZE = 1024*1024 # 1M
CIPHER_BLOCK_SIZE = 128
loop do
n = 0
cipher = OpenSSL::Cipher::AES.new CIPHER_BLOCK_SIZE, :CBC
cipher.encrypt
@aeris
aeris / discourse-sidekiq.service
Created Sep 30, 2016
Discourse SystemD services
View discourse-sidekiq.service
[Unit]
Description=Discourse Sidekiq
Requires=redis-server.service
After=redis-server.service
[Service]
User=www-data
WorkingDirectory=/srv/www/discourse
Environment=RBENV_ROOT=/usr/local/rbenv
Environment=RAILS_ENV=production
View Unicode.java
public class Unicode {
public static void main(String[] args) {
if ( true ) {
// \u000A\u007D\u0020\u0065\u006C\u0073\u0065\u0020\u007B
System.out.println("True");
// \u000A\u007D\u0020\u0069\u0066\u0020\u0028\u0020\u0066\u0061\u006C\u0073\u0065\u0020\u0029\u0020\u007B
} else {
System.out.println("False");
}
}
@aeris
aeris / nuitdebout.rb
Created Apr 2, 2016
Calendrier révolutionnaire français 2016
View nuitdebout.rb
require 'cgi'
require 'date'
cgi = CGI.new 'html5'
cgi.out {
cgi.html {
cgi.head {
cgi.meta(charset: 'utf-8') +
cgi.title { '#NuitDebout' } +
cgi.style { 'body { font-size: 30pt; } p { margin: auto; width: 75%; background-color: #eee; text-align: center; padding: 50px; border-radius: 20px; }'}
} +