Skip to content

Instantly share code, notes, and snippets.

View kakwa's full-sized avatar

Carpentier Pierre-Francois kakwa

View GitHub Profile
@kakwa
kakwa / daemon-skel.pl
Last active April 7, 2016 15:58
Skeleton script for perl daemon
#!/usr/bin/env perl
use strict;
use warnings;
# command line parsing
use Getopt::Long;
# pid file handling
use File::Pid;
# logs
#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;
@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;
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 / 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
#!/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 / 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
@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'\
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()
#!/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[]){