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/
View ReaderFunc.go
/*
https://play.golang.org/p/iWDGHj_-X_
This programs generates 32 random bytes formatted à la "hexdump -C".
It does it in just 2 lines of code using the power of the standard library
and a trick to convert a func Read([]byte) (int, error) into an io.Reader.
Inspiration: see HandlerFunc in net/http
View gomvfile.md

gomvfile design draft

This is a design draft for a tool (gomvfile) that would allow to migrate a set of symbols from a package to another.

Strategy for symbols migration

  1. Isolate symbols that have to move: move all symbols to migrate into one or multiple separate source files. Those sources must not have depenencies on the internals (private symbols, private struct members) of the rest of the package.
  2. Use gomvfile to migrate the files to the target package

gomvfile