Skip to content

Instantly share code, notes, and snippets.

View parastuffs's full-sized avatar
🐦

Quentin Delhaye parastuffs

🐦
  • ECAM
  • Brussels
View GitHub Profile

Custom askmaps

This is a custom implementation of the TeX package askmaps from Jesse op den Brouw.

What is changes is twofold:

  1. It corrects the Hamming distances of the 5 variables K-maps so that it's compliant with EPB/BEAMS courses.

    When using more than four variables, Hamming distances can not be respected anymore and the table needs to be split into 4x4 sub-tables. Still, n-cubes can span over sub-tables, but their apsect will vary depending on the Hamming distances. Two cells belonging to different sub-tables will be adjacent (within the meaning of Hamming distance) when they are superimposed after the sub-tables have either been folded or stacked.

<?php
$dirname = $_SERVER['DOCUMENT_ROOT'].'/';
$dir = opendir($dirname);
while($file = readdir($dir)) {
if($file != '.' && $file != '..' && $file != 'index.php')
{
//echo '<a href="'.$file.'">'.$file.'</a>';
$filelist[] = $file;
}
@parastuffs
parastuffs / diffass.pl
Created January 26, 2016 21:38
Output the lines that were modified between two .ass, ignoring the time.
use strict;
use warnings;
my $filenameOrig = 'Senkou 06 OK.ass';
my $filenameMod = 'Senkou 06 OK_adpat.ass';
open my $fileOrig, $filenameOrig or die "Could not open $filenameOrig: $!";
open my $fileMod, $filenameMod or die "Could not open $filenameMod: $!";
while( my $lineMod = <$fileMod>) {
seek $fileOrig, 0, 0;
#!/usr/bin/python
import sys
"""
Usage: ./asciiize "string to ASCII-ize"
Only lower case, spaces allowed.
https://gist.github.com/parastuffs/e497d81dd14c7daba094
"""
@parastuffs
parastuffs / rename_mp3.sh
Created July 14, 2015 18:53
Rename all mp3 files in folder into "Artist - Track title.mp3" base on mp3 tags.
#!/bin/bash
# Rename all mp3 files in folder into "Artist - track title.mp3" base on mp3 tags.
# Requires mp3info
SAVEIFS=$IFS
IFS=$(echo -en "\n\b");
for f in `ls *.mp3`; do
artist=`mp3info -p %a $f`
title=`mp3info -p %t $f`
mv ${f} "${artist} - ${title}.mp3"
@parastuffs
parastuffs / remove_old_i386.sh
Last active August 29, 2015 14:24
Remove common i386/amd64 packages
#!/bin/bash
i=1
echo "Get AMD64 packages"
sudo aptitude search '~ramd64~i' | awk '{print $2}' > packages.amd64
echo "Get i386 packages"
sudo aptitude search '~ri386~i' | awk '{print $2}' | sed -e 's/:i386//' > packages.i386
echo "Compute common lines"
comm -1 -2 --nocheck-order packages.i386 packages.amd64 > packages.comm
@parastuffs
parastuffs / link_openssl_vanilla.sh
Created February 18, 2015 09:43
Link local openssl to custom install
#!/usr/bin/env perl
use strict;
use warnings;
use String::CRC32;
use File::Copy;
my (@files);
open(FD1, "ls *.mp4 *.mkv |");
@parastuffs
parastuffs / gist:b987251f305bcc13d993
Last active August 29, 2015 14:09
Car playlist for morons
CD_SIZE_MAX = 700 Mo;
cd_size = 0;
track_index = 0;
passengers.add(Quentin, Anthony, Aurélien, Florian);
car_playlist = empty();
while(cd_size < CD_SIZE_MAX) {
for(moron in passengers) {
@parastuffs
parastuffs / Psycho-Pass_lexique
Last active August 29, 2015 14:07
Psycho-Pass lexique
oo Noms des personnages :
Lieutenant (et non inspecteur)
Kôgami Shinya
Tsunemori Akane
Ginoza Nobuchika
Masaoka Tomomi
Kagari Shûsei
Kunizuka Yayoi
Karanomori Shion