Skip to content

Instantly share code, notes, and snippets.

@pasora
pasora / gitdiffadd
Created July 30, 2018 09:48
This is a script performing git status -> git diff -> git add.
#!/bin/bash
for f in $(git status | gawk 'BEGIN{staged=0}{if(staged){if(/modified:/){print gensub(/.*modified:[ \\t]*(.*)/,"\\1","g",$0)}}if(/^Changes not staged for commit:$/){staged=1}}')
do
clear
git status
echo "Target file: ${f}"
# git diff
@pasora
pasora / setup_raspi.md
Last active October 28, 2016 00:06
単なるメモ

raspi-config

System

  • Expand Filesystem
  • Change Password
  • Change Hostname
  • Disable Auto Login
  • Disable Underscan
@pasora
pasora / ip_line_notify.sh
Created October 27, 2016 07:35
Inform IP address to LINE Notify
#!/bin/sh
ip=`curl ipinfo.io/ip`
curl -X POST -H 'Authorization: Bearer [your_access_token]' -F "message=${ip}" https://notify-api.line.me/api/notify > /dev/null 2>&1
exit 0
@pasora
pasora / temp_line_notify.sh
Created October 26, 2016 08:49
Warning High CPU Temperature from Raspberry Pi to LINE Notify
#!/bin/sh
# degined for Raspberry Pi 3
# before running, you have to install bc by `sudo apt-get install bc`
temp=`vcgencmd measure_temp | sed -e 's/temp\=//' -e "s/'C//"`
if [ "$(echo "$temp > 40.0" | bc)" -eq 1 ]; then
curl -X POST -H 'Authorization: Bearer [your_access_token]' -F "message=現在${temp}度です" https://notify-api.line.me/api/notify > /dev/null 2>&1
fi