This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
grep HOGEHOGE fuga.csv | awk -F ',' 'BEGIN{before=0} { print $1, $9 - before; before=$9; }' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
# Copyright (C) 2012 Shimomura Kimihiko <kshimo69@gmail.com> | |
import numpy as np | |
import pylab | |
import libXKCD | |
np.random.seed(0) | |
ax = pylab.axes() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if which pbcopy >/dev/null 2>&1 ; then | |
# Mac | |
COPY='pbcopy' | |
elif which xsel >/dev/null 2>&1 ; then | |
# Linux | |
COPY='xsel --input --clipboard' | |
elif which putclip >/dev/null 2>&1 ; then | |
# Cygwin | |
COPY='putclip' | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# vim: fileencoding=utf8 | |
import socket | |
import random | |
IPMSG_VERSION = 0x0001 | |
IPMSG_SENDMSG = 0x00000020 | |
IPMSG_SECRETOPT = 0x00000200 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for i in /proc/[0-9]*; do echo "==== $i ===="; for j in Rss Shared Private Swap; do printf "%-10s" $j; grep $j $i/smaps | awk 'BEGIN{n=0}{n += $2}END{printf "%8s (kB)\n", n}'; done; done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FILE="tmp"; for i in messages.4 messages.3 messages.2 messages.1 messages; do while read LINE; do if echo $LINE|grep -q restart; then FILE="`echo $LINE|awk '{ print $1$2$3 }'`.log"; fi; echo $LINE >> $FILE; done < $i; done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
crash> ps | grep sshd | |
3475 3642 0 ffff810012598040 IN 0.6 90120 3380 sshd | |
3642 1 0 ffff81001906f7e0 IN 0.2 62616 1212 sshd | |
4254 3642 0 ffff81000e60d860 IN 0.6 90120 3376 sshd | |
crash> net -s 3475 | |
PID: 3475 TASK: ffff810012598040 CPU: 0 COMMAND: "sshd" | |
FD SOCKET SOCK FAMILY:TYPE SOURCE-PORT DESTINATION-PORT | |
3 ffff81000f182800 ffff81000ecbb380 INET:STREAM xxx.xxx.xxx.xxx-22 yyy.yyy.yyy.yyy-1523 | |
6 ffff81000ee41840 ffff81000ecbb980 INET:STREAM 127.0.0.1-6010 0.0.0.0-0 | |
crash> struct socket ffff81000f182800 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define _GNU_SOURCE | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <unistd.h> | |
#include <sys/types.h> | |
#include <sys/stat.h> | |
#include <fcntl.h> | |
#include <sys/time.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/stap | |
# usage: stap -vvv func.stp 'kernel.function("end_buffer_async_read")' | |
probe begin { | |
printf("\n") | |
} | |
probe $1 { | |
printf("%s %s() called pid=%d, pname=%s\n", ctime(gettimeofday_s()+32400), probefunc(), pid(), execname()) |
NewerOlder