Skip to content

Instantly share code, notes, and snippets.

<!DOCTYPE html>
<html manifest="iv.appcache">
<head>
<title>IV</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<link rel="shortcut icon" type="image/x-icon" href="iv-57x57.png" />
<link rel="apple-touch-icon" href="iv-57x57.png">
@Daml
Daml / sneef.c
Last active April 16, 2018 14:33
Match a special ICMP packet
# On OSX
ping -p d0d0
# On linux
iptables -I INPUT -i eth0 -p icmp -m u32 --u32 "6&0xFF=1 && 4&0x1FFF=0 && 0>>22&0x3C@16=0xD0D0D0D0" -j LOG --log-prefix "paf"
@Daml
Daml / secteurs-metro.geojson
Created June 23, 2016 09:31
Découpage des secteurs de Grenoble Alpes Métropoles
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
platform = require('os').platform()
fs = require 'fs'
webcams = []
detect_linux = ->
devices = fs.readdirSync '/sys/class/video4linux'
for video in devices
data = fs.readFileSync "/sys/class/video4linux/#{video}/name", "utf-8"
webcams.push {
@Daml
Daml / gist:4251250
Created December 10, 2012 15:27
Non blocking streaming tail + unbuffered grep + mail result
tail -F /var/log/apache2/access.log | grep --line-buffered "\[500" | while read line
do
echo "$line"
echo "$line" | mail -s "HTTP 500" "tech@localhost"
done
@Daml
Daml / gist:1872602
Created February 21, 2012 00:45
bind osx securelog's ssh entries to growl
#!/bin/sh
GNOPTIONS="-n growlssh -a SSHKeychain.app -t ssh -s"
sudo tail -F /var/log/secure.log \
| grep --line-buffered 'ssh' \
| grep --line-buffered -v 'Kerberos' \
| xargs -I {} growlnotify $GNOPTIONS -m "{}"
@Daml
Daml / gist:1839232
Created February 15, 2012 21:50
bash completion pour make
_makefile_targets() {
local cur opts
cur="${COMP_WORDS[COMP_CWORD]}"
opts=$(grep "^[[:alnum:]-]*:" Makefile | cut -d: -f 1 | tr "\n" " ")
COMPREPLY=( $(compgen -W "${opts}" ${cur}) )
return 0
}
complete -F _makefile_targets make
@Daml
Daml / gist:1433602
Created December 5, 2011 13:36
A very simple benchmark timer
<?php
/**
* A very simple benchmark timer.
*
* Return a closure wich embed init and last call timestamps.
*
* Each call of that closure push to error log the filename,
* milliseconds since init, milliseconds since last call
* and free label given in parameters.
@Daml
Daml / gist:1262919
Created October 4, 2011 21:44
Re-bind iterm2 to +<space>
defaults delete com.googlecode.iterm2 HotKeyBookmark
defaults write com.googlecode.iterm2 Hotkey 1
defaults write com.googlecode.iterm2 HotkeyChar 32
defaults write com.googlecode.iterm2 HotkeyCode 49
defaults write com.googlecode.iterm2 HotkeyModifiers 1048840
@Daml
Daml / gist:1104417
Created July 25, 2011 15:40
Growl for quick debug/scripts
<?php
/**
* Growl for quick debug/scripts, for serious business see
* https://github.com/tylerhall/php-growl/
*/
function growl( $text ) {
$val = false;
$str = sprintf(