Skip to content

Instantly share code, notes, and snippets.

View kakwa's full-sized avatar

Carpentier Pierre-Francois kakwa

View GitHub Profile
notkill(){ printf "killing process: $1\n";tmpdir=`mktemp -d`;[ $? -eq 0 ] || return 1;printf "#include <sys/types.h>\n#include <signal.h>\n#include <stdlib.h>\nint main(int argc, char * argv[]){\nif (argc <= 1)\nreturn 1;\nint pid = atoi(argv[1]);\nint ret = kill(pid, SIGTERM);\nreturn ret;\n}" > $tmpdir/file.c; gcc $tmpdir/file.c -o $tmpdir/notkill;$tmpdir/notkill $1;ret=$?;! [ -z "$tmpdir" ] && [ -d "$tmpdir" ] && rm -rf $tmpdir;return $ret; }; notkill <YOUR PID>
#!/bin/sh
tmpdir=`mktemp -d`;
[ $? -eq 0 ] || exit 1;
cat >$tmpdir/file.c <<EOF
#include <sys/types.h>
#include <signal.h>
#include <stdlib.h>
#include <stdio.h>
int main(int argc, char * argv[]){
from HTMLParser import HTMLParser
import urllib2
import re
# create a subclass and override the handler methods
class MyHTMLParser(HTMLParser):
def __init__(self):
"""Initialize and reset this instance."""
self.flag = False
self.reset()
@kakwa
kakwa / get_rdvx.sh
Created August 14, 2015 20:41
An ugly script to recover and rename "Rendez-Vous avec Monsieur X" recordings.
#!/bin/bash
# An ugly script to recover and rename "Rendez-Vous avec Monsieur X" recordings.
# (past radio show from french station France Inter).
# It also resets id3 tags and sets them to correct values.
i=1
wget -O - http://rendezvousavecmrx.free.fr/page/liste.php\?tri\=4 | \
grep mp3 |grep href | \
sed 's/.*href="\(.*\)".*src=.*alt.*title="\(.*\)".*/\1:\2/p;d'\
@kakwa
kakwa / ghipr.py
Last active November 21, 2015 12:51
Quick and dirty script to display the number of opened issues and PRs on a list of Github projects
#!/usr/bin/env python
import urllib2
import json
import sys
import codecs
import base64
# Quick and dirty script to display the number of opened issues and PRs on a list of Github projects
#!/bin/sh
RCol='\33[0m' # Text Reset
# Regular Bold Underline High Intensity BoldHigh Intens
Bla='\33[0;30m'; BBla='\33[1;30m'; UBla='\33[4;30m'; IBla='\33[0;90m'; BIBla='\33[1;90m';
Red='\33[0;31m'; BRed='\33[1;31m'; URed='\33[4;31m'; IRed='\33[0;91m'; BIRed='\33[1;91m';
Gre='\33[0;32m'; BGre='\33[1;32m'; UGre='\33[4;32m'; IGre='\33[0;92m'; BIGre='\33[1;92m';
Yel='\33[0;33m'; BYel='\33[1;33m'; UYel='\33[4;33m'; IYel='\33[0;93m'; BIYel='\33[1;93m';
Blu='\33[0;34m'; BBlu='\33[1;34m'; UBlu='\33[4;34m'; IBlu='\33[0;94m'; BIBlu='\33[1;94m';
@kakwa
kakwa / start.sh
Created December 7, 2015 16:45
start all vms on an esxi host
#!/bin/sh
vim-cmd vmsvc/getallvms | awk '{print $1}' | while read id; do vim-cmd vmsvc/power.on $id;done
cloc --not-match-f='.*.js|.*.css|.*.less' ./
743 text files.
623 unique files.
7394 files ignored.
http://cloc.sourceforge.net v 1.60 T=1.69 s (174.7 files/s, 25039.8 lines/s)
-------------------------------------------------------------------------------
Language files blank comment code
-------------------------------------------------------------------------------
Python 74 1728 2046 7577
@kakwa
kakwa / wRle8ToBitmap.c
Last active January 22, 2016 00:27
uncompress Windows RLE8 to get bitmap
#include <stdlib.h>
#include <stdio.h>
#include <stddef.h> /* for offsetof() macro */
#include <string.h>
#include <stdint.h>
#include <stdbool.h>
#include <unistd.h>
typedef struct _dibImg {
char *img;
#include <stdlib.h>
#include <stdio.h>
#include <stddef.h> /* for offsetof() macro */
#include <string.h>
#include <stdint.h>
#include <stdbool.h>
#include <unistd.h>
typedef struct _dibImg {
uint8_t *img;