Skip to content

Instantly share code, notes, and snippets.

View ryuichiueda's full-sized avatar

Ryuichi Ueda ryuichiueda

View GitHub Profile
#!/bin/bash
ps aux |
grep js |
grep Cloud |
awk '{print $2}' |
xargs kill -KILL
@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
@ryuichiueda
ryuichiueda / wiringPiLedBlink.c
Created November 6, 2015 10:27
wiringPi LED blink
#!/bin/bash
echo $$
sleep 30
exec sleep 100 #ここでプロセスがsleep に置き換わる
echo ここには来ない
@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
syntax on
let g:neocomplcache_enable_at_startup = 1
let g:neocomplcache_snippets_dir = $HOME.'/.vim/snippets'
syntax enable
" <C-k> にマッピング
imap <C-k> <Plug>(neocomplcache_snippets_expand)
import PATH
### ヒアドキュメントを実装する ###
### 代わりに改行できる変数を実装 ###
file awkcode = '{print NR,$1}'
### 変数は直接パイプに突っ込める###
'a
b
c' >>= awk -f awkcode
import PATH
#############################
# fizzbuzz.glue (for Mac) #
#############################
# make a file "nums"
file nums = seq 1 100
#gsed can be installed after "brew install coreutils"
import PATH
sleep 3 >> echo 'abc' >>= rev &a
sleep 2 >> echo 'def' >>= rev &b
in.wait a b
echo 'OK'
uedambp:GlueLang ueda$ ./glue -v hoge.glue
+ pid 90998 fork a
+ pid 91000 fork
+ pid 91000 exec line 3 /bin/echo
+ pid 91001 fork
+ pid 91001 exec line 2 /bin/sleep
a
+ pid 91000 exit 0
+ pid 91001 exit 0
+ pid 91002 fork