View jsonl
#!/usr/local/bin/jq -cf
# This script transforms a JSON input containing a single array into the "JSON Lines" format (http://jsonlines.org)
# See https://stackoverflow.com/questions/42178636/how-to-use-jq-to-output-jsonl-one-independent-json-object-per-line
#
# Install:
# - save this file as "jsonl"
# - install jq (https://stedolan.github.io/jq/)
# - chmod u+rx jsonl
#
View structintmap.go
package structintmap
import "reflect"
func StructIntMap(value interface{}) map[string]int {
m := make(map[string]int)
structIntMap(reflect.ValueOf(value), m, "")
return m
}
View export-wifi-profiles.cmd
:: Run with full administrator rights
netsh wlan export profile folder=. key=clear
View hello.c
///usr/bin/cc -o "${0%.c}" "$0" && exec "./${0%.c}"
// Author: Olivier Mengué
// Install: chmod u+x hello.c
#include <stdio.h>
int main()
{
puts("hello world");
View darwin-signames.sh
# From /usr/include/signal.h
cc -E -dM /usr/include/signal.h | sed -nE 's/^#define (SIG[A-Z0-9]+ +[1-9][0-9]{0,1})$/\1/p' | sort -n -k 2
# Or
kill -l
View git-on-lenny.sh
# Mise à jour du système
sudo vim /etc/sources.list
# - suppression de ftp.fr.debian.org qui ne contient plus lenny
# - ajout
# deb http://archive.debian.org/debian/ lenny main
# deb-src http://archive.debian.org/debian/ lenny main
gpg --keyserver subkeys.pgp.net --recv-keys AED4B06F473041FA
gpg -a --export AED4B06F473041FA | sudo apt-key add -
sudo apt-get update
sudo aptitude safe-upgrade
View structintmap.go
package main
import "reflect"
func StructIntMap(value interface{}) map[string]int {
m := make(map[string]int)
structIntMap(reflect.ValueOf(value), m, "")
return m
}
View DATETIME-to-TIMESTAMP.sql
SELECT CONCAT('ALTER TABLE `',TABLE_SCHEMA,'`.`', TABLE_NAME, '` ', GROUP_CONCAT(' MODIFY COLUMN "', COLUMN_NAME, '` TIMESTAMP ',IF(IS_NULLABLE = 'NO','NOT',''),' NULL'),';')
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_SCHEMA = DATABASE()
AND DATA_TYPE = 'DATETIME'
GROUP BY TABLE_SCHEMA, TABLE_NAME
View putty.ti
#!/usr/bin/tic
#
# Reconstructed via infocmp from file: /usr/share/terminfo/p/putty
# from Redhat 4 update 3 for PuTTY 0.58
#
# Added: tsl, flash, fsl, ka1, ka3, kb2, kc1, kc3, kend, kent, khome, ich,
# btns, indn, rin, curses, setf, setb, dispc, rmpch, smpch, kcan,
# kspd, lm
# Changed: colors (256 colors), setab (256 colors), setaf (256 colors)
# Optimized: csr, cub, cud, cuf, cuu, dch, dl, ich, il
View JSON-regexp.pl
use 5.012;
#
# Regexp for a unicode string JSON
# (the BOM and decoding must have been processed before)
# This means that with PCRE (used for example in PHP), the input must
# have been converted to UTF-8 and the '/u' flag must be given
#
my $json_regex =
qr/