Skip to content

Instantly share code, notes, and snippets.

@labeneator
labeneator / gist:3159873
Created July 22, 2012 14:37
serial_ping
$ time for ip in $(< /tmp/pinglist); do ping -c 2 $ip; echo; done
PING 127.0.0.1 (127.0.0.1) 56(84) bytes of data.
64 bytes from 127.0.0.1: icmp_req=1 ttl=64 time=0.115 ms
64 bytes from 127.0.0.1: icmp_req=2 ttl=64 time=0.031 ms
--- 127.0.0.1 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 999ms
rtt min/avg/max/mdev = 0.031/0.073/0.115/0.042 ms
PING 127.0.0.2 (127.0.0.2) 56(84) bytes of data.
@labeneator
labeneator / gist:3159880
Created July 22, 2012 14:42
parallel_ping_with_output_race
$ time cat /tmp/pinglist | xargs --max-args=1 --max-procs=10 -IZ ping -c 1 Z
PING 127.0.0.2 (127.0.0.2) 56(84) bytes of data.
PING 192.168.127.120 (192.168.127.120) 56(84) bytes of data.
PING 192.168.122.1 (192.168.122.1) 56(84) bytes of data.
PING 10.10.10.50 (10.10.10.50) 56(84) bytes of data.
64 bytes from 192.168.127.120: icmp_req=1 ttl=64 time=0.043 ms
--- 192.168.127.120 ping statistics ---
64 bytes from 192.168.122.1: icmp_req=1 ttl=64 time=0.034 ms
64 bytes from 127.0.0.2: icmp_req=1 ttl=64 time=0.043 ms
@labeneator
labeneator / gist:3159886
Created July 22, 2012 14:44
parallel_ping_with_output_race_fixed
$ time cat /tmp/pinglist | xargs --max-args=1 --max-procs=10 -IZ flock -x /tmp/pinglist -c "ping -c 1 Z; echo"
PING 127.0.0.1 (127.0.0.1) 56(84) bytes of data.
64 bytes from 127.0.0.1: icmp_req=1 ttl=64 time=0.096 ms
--- 127.0.0.1 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.096/0.096/0.096/0.000 ms
PING 192.168.122.1 (192.168.122.1) 56(84) bytes of data.
64 bytes from 192.168.122.1: icmp_req=1 ttl=64 time=0.091 ms
diff --git a/plugin/restore_view.vim b/plugin/restore_view.vim
index cf43019..aff1404 100644
--- a/plugin/restore_view.vim
+++ b/plugin/restore_view.vim
@@ -43,6 +43,7 @@ function! MakeViewCheck()
if &modifiable == 0 | return 0 | endif
if len($TEMP) && expand('%:p:h') == $TEMP | return 0 | endif
if len($TMP) && expand('%:p:h') == $TMP | return 0 | endif
+ if strlen(expand('%:p')) > 31 | return 0 | endif
# Capture 100 Packets
sh-3.2# tshark -i en1 -c 100 -s0 -w dns.pcap port 53
Capturing on en1
100
# Pcap Size
sh-3.2# du -sh dns.pcap
16K dns.pcap
# 100 Packets to a text file
# dtruss: an strace equivalent for OSX
# dtruss nslookup www.google.com
Server: 192.168.1xx.2
Address: 192.168.1xx.2#53
Non-authoritative answer:
Name: www.google.com
Address: 197.80.128.24
@labeneator
labeneator / gist:4589177
Created January 21, 2013 20:44
Syscall tracing in osx
sh-3.2# date; syscallbypid.d; date
Sun Jan 20 22:42:47 SAST 2013
Tracing... Hit Ctrl-C to end.
^C
PID CMD SYSCALL COUNT
1 launchd fork 1
...
...
61275 dtrace workq_kernreturn 82
87 eTSrv stat64 86
# Process
sh-3.2# ps aux | grep " [1]3\W"
root 13 0.0 0.3 2497244 13416 ?? Rs Thu08PM 1:52.96 /usr/libexec/opendirectoryd
# What file thinks
sh-3.2# file /usr/libexec/opendirectoryd
/usr/libexec/opendirectoryd: Mach-O universal binary with 2 architectures
/usr/libexec/opendirectoryd (for architecture x86_64): Mach-O 64-bit executable x86_64
/usr/libexec/opendirectoryd (for architecture i386): Mach-O executable i386
@labeneator
labeneator / alpr.py
Last active July 19, 2019 14:45
alpr.py - Automatic number plate recognition
#! /usr/bin/env python
import cv2
import numpy as np
import pymeanshift as pms
from blobs.BlobResult import CBlobResult
from blobs.Blob import CBlob # Note: This must be imported in order to destroy blobs and use other methods
@labeneator
labeneator / leaky.c
Created February 27, 2013 16:04
Leaky program
#include <stdio.h>
#include <unistd.h>
#include <string.h>
void open_file(char *filename)
{
FILE *fd = fopen(filename, "r");
}
int main(void)