Skip to content

Instantly share code, notes, and snippets.

View ryuichiueda's full-sized avatar

Ryuichi Ueda ryuichiueda

View GitHub Profile
#include <stdio.h>
#include <stdlib.h>
int main(){
int pid = fork(); //子の場合: 0, 親の場合: 子のPID
//子の処理
if (pid == 0){
while(1){
sleep(1);
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
int main(){
sleep(10);
execl("/bin/sleep","/bin/sleep","10",NULL);
puts("ここには来ない");
}
#include <stdio.h>
#include <stdlib.h>
int main(){
int pid = fork(); //子の場合: 0, 親の場合: 子のPID
//子の処理
if (pid == 0){
puts("child");
exit(0);
/* fold.c nバイトずつ折り返す */
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char const* argv[])
{
if(argc != 2)
exit(1);
int i = 0;
#!/bin/bash -xv
cat << FIN > /tmp/header
P2
600 600
255
FIN
###真っ黒な画###
seq -w 0 359999 > /tmp/body
#!/bin/bash
# github-connect.sh
# -----------------
# Copyright 2012 Andrew Coulton - released under the BSD licence
# modified by Ryuichi Ueda 20140923
#
# A simple command line script to set up and register an SSH key against a
# user's github account - for example when provisioning a new virtual
# machine for a developer.
@ryuichiueda
ryuichiueda / index.glue
Created September 24, 2014 08:27
index.glue for kiyou 2014
func mkNavi page:
grep -B 1 -A 1 "$page"
tr '\n' ' '
awk '{print $1,$NF}'
tr ' ' '\n'
awk 'NR==1{print "前の記事",$1}NR==2{print "後の記事",$1}'
grep -v "$page"
sed 's/_/\\_/g'
proc fixPage dir page:
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)
@ryuichiueda
ryuichiueda / hoge.glue
Created January 16, 2015 06:26
a demo at USP lab. (Jan 16, 2015)
import /usr/bin/ as ub
import /bin/ as b
# not a Haskell code but a glue code
# how to write a procedure (function of bash)
proc pppp =
import /usr/bin/ as ub
ub.seq 1 10
>>= ub.tail -r
@ryuichiueda
ryuichiueda / where.glue
Last active August 29, 2015 14:13
import PATH diff a b where file a = seq 10 file b = seq 10 ? diff c d where file c = seq 8 file d = seq 10
import PATH
# "file a = ..." and "file b" = ... are evaluated before "diff a b"
diff a b
where file a = seq 10
file b = seq 10
# ? is required because this diff returns 1
? file ans = diff c d
where file c = seq 8