Skip to content

Instantly share code, notes, and snippets.

View ryuichiueda's full-sized avatar

Ryuichi Ueda ryuichiueda

View GitHub Profile
@ryuichiueda
ryuichiueda / to_fukuoka
Created April 18, 2015 06:40
福岡会場へ・・・
ueda@tencore:~/tmp/nasa$ zcat access_log.nasa.gz | awk '{print $4,$0}' |
sed 's/^\[//' | awk '{gsub(/[\/:]/," ",$1);print}' |
awk '{$2=$2=="Jul"?"07":$2;$2=$2=="Aug"?"08":$2;print}' |
sed 's;^\(..\) \(..\) \(....\) \(..\) \(..\) \(..\);\3\2\1 \4\5\6;' > access_log
ueda@tencore:~/tmp/danger$ zcat access.log.shellshock.gz | awk '{print $4,$0}' |
sed 's/^\[//' | awk '{gsub(/[\/:]/," ",$1);print}' |
sed -e 's/Sep/09/' -e 's/Oct/10/' -e 's/Nov/11/' -e 's/Dec/12/' |
sed 's;^\(..\) \(..\) \(....\) \(..\) \(..\) \(..\);\3\2\1 \4\5\6;' > danger_log
#!/bin/bash
echo $$
sleep 30
exec sleep 100 #ここでプロセスがsleep に置き換わる
echo ここには来ない
@ryuichiueda
ryuichiueda / wiringPiLedBlink.c
Created November 6, 2015 10:27
wiringPi LED blink
@ryuichiueda
ryuichiueda / main.cc
Last active November 6, 2015 15:41
blink LED without WiringPi
#include <iostream>
#include <stdint-gcc.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/mman.h>
using namespace std;
/* GPIOで一つだけLEDを点滅させるC++のコード
* written by Ryuichi Ueda
#!/bin/bash
ps aux |
grep js |
grep Cloud |
awk '{print $2}' |
xargs kill -KILL
ueda@ubuntu14:~$ sudo udevadm monitor --kernel --property
monitor will print the received events for:
KERNEL - the kernel uevent
KERNEL[159.305967] add /module/sushi (module)
ACTION=add
DEVPATH=/module/sushi
SEQNUM=1568
SUBSYSTEM=module
ueda@ubuntu14:~$ sudo udevadm monitor --kernel --property
[sudo] password for ueda:
monitor will print the received events for:
KERNEL - the kernel uevent
KERNEL[443.349199] remove /devices/virtual/sushi/sushi0 (sushi)
ACTION=remove
DEVNAME=/dev/sushi0
DEVPATH=/devices/virtual/sushi/sushi0
MAJOR=249
# GitHubから来た通知をSlackに飛ばす
#
# 参考: Hubot経由でGitHubのイベントを通知する | SPACEMARKET BLOG
# http://blog.spacemarket.com/code/hubot-github-webhook-1/
crypto = require 'crypto'
module.exports = (robot) ->
robot.router.post "/github/webhook", (req, res) ->
event_type = req.get 'X-Github-Event'
signature = req.get 'X-Hub-Signature'
#!/bin/sh
set -e
npm install
export PORT=8989
export PATH="node_modules/.bin:node_modules/hubot/node_modules/.bin:$PATH"
export HUBOT_SLACK_TOKEN=xxxxxx
export HUBOT_GITHUB_SECRET=yyyyyyy
$ cat holidays | awk '{print $1,$NF}' | awk '{print $1,a,b,$2;a=b;b=$2}' | grep '1 0 1$' | awk '{print $1}' | while read d ; do echo '----' ; grep -B2 $d holidays ; done