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
(defun sum-n (n) | |
(if (= n 1) | |
1 | |
(+ n (sum (- n 1))))) | |
(defun check-div (num) | |
(labels ((check-div-r (n k) | |
(if (= k 1) | |
1 | |
(if (integerp (/ n k)) |
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
(defun sum-n (n) | |
"(+ 1 2 3 ... n)" | |
(* n (1+ n) 1/2)) | |
(defun check-div (num) | |
"return number of factors of num" | |
(labels ((check-div-r (n k) | |
(if (= k 1) | |
1 | |
(if (integerp (/ n k)) |
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 | |
import math as m | |
def check_div(num): | |
ret = 0 | |
sq = m.sqrt(num) | |
for i in range(1, int(round(sq))+1): | |
if num % i == 0: | |
ret += 1 |
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
cat << \__EOF__ >> ~/.bashrc | |
# notify when rosmake finished | |
# from https://gist.github.com/furushchev/7170086/ | |
alias alert_helper='history|tail -n1|sed -e "s/^\s*[0-9]\+\s*//" -e "s/;\s*alert$//"' | |
alias alert='notify-send -i /usr/share/icons/gnome/32x32/apps/gnome-terminal.png "[$?] $(alert_helper) finished."' | |
function rosmake(){ |
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
function napr(){ | |
local FROM TO | |
if [ $# -eq 1 ]; then | |
FROM="ru"; TO="ja" | |
elif [ $# -eq 3 ]; then | |
FROM=$2; TO=$3 | |
else | |
echo -e "[usage] napr phrase [from(ru) to(ja)]\n To end press 'q'" 1>&2 | |
echo -e "e.g\n napr например ru ja\n napr 例 ja ru" 1>&2 | |
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
#!/bin/bash | |
cat <<EOF >> ~/.bashrc | |
function alert(){ | |
local SAY="say -v Otoya" # use "say -v Kyoko" if you like female | |
if [ \$# -ge 1 ]; then | |
\$@ && \$SAY "\$@ が おわったでー。" | |
else | |
\$SAY "なにすんねん!" |
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
#!/bin/bash | |
if [ "$1" = "" ]; then | |
GLOBAL_IP=`curl -s ifconfig.me` | |
else | |
GLOBAL_IP=$1 | |
fi | |
USERNAME=username | |
PASSWORD=password | |
HOSTNAME=hostname |
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
#!/bin/bash | |
function abort() { | |
echo "error: $1" | |
echo "abort..." | |
exit 1 | |
} | |
# find ws root | |
PKGPATHS=`rospack list | grep src` |
![pr2_interface.png](https://gist.github.com/furushchev/37b003f33fd604c8f88a/raw/ec25a9427b3b82919bf46c2981d648b82febd49c/pr2_interface.png)
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 roseus | |
(setq *l* nil) | |
#| | |
(defun fuga (cds) | |
(print "called fuga") | |
(print cds) | |
(print *l*) | |
(push (list #'fuga cds) *l*) ;; applyしたときにここでとまってしまう | |
(print *l*) |
OlderNewer