This file contains hidden or 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 bash | |
| # | |
| # Upgrade all installed pip modules at once. | |
| # | |
| pip list| awk '{print $1}' | xargs pip install --upgrade |
This file contains hidden or 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 bash | |
| # | |
| # This script will generate a report of packages which needs to be upgraded | |
| # on your system. The report will be emailed to you. | |
| # | |
| # Look for MAILRCPT= further down and change that to your email address | |
| # | |
| # You need "mailutils" and "update-notifier-common" installed on your system, | |
| # and you need to be able to send email from the system (i.e. no firewall | |
| # blocking SMTP) |
This file contains hidden or 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 bash | |
| MAX=80 | |
| G=$( bc <<< "${MAX}*5/10" ) | |
| VG=$( bc <<< "${MAX}*8/10" ) | |
| BETYG=$(( ${RANDOM}%${MAX}+1 )) | |
| echo -n "Dina poäng på tentan var ${BETYG}, ditt betyg är " |
This file contains hidden or 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
| wget http://ftp.gnome.org/mirror/cygwin/x86/release/zsync/zsync-0.6.2-1.tar.bz2 | |
| tar jxvf zsync-0.6.2-1.tar.bz2 | |
| cd zsync-0.6.2-1 | |
| ./configure --disable-dependency-tracking --prefix=/usr/local/zsync | |
| make | |
| sudo make install | |
| ln -s /usr/local/zsync/bin/zsync /usr/local/bin/zsync | |
| ln -s /usr/local/zsync/bin/zsyncmake /usr/local/bin/zsyncmake |
This file contains hidden or 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 bash | |
| # | |
| # Read a file with list of elements, separated by newline | |
| # output that list to an array | |
| # | |
| FIRST=true | |
| VARNAME="varname" | |
| echo -n "${VARNAME}='" | |
| for a in $(< input.txt) ; do |
This file contains hidden or 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
| <?php | |
| function check_int($str) { | |
| if(is_int($str)) { | |
| return abs(intval($str)); | |
| } else { | |
| return "false"; | |
| } | |
| } |
This file contains hidden or 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 | |
| # -*- coding: utf-8 -*- | |
| """ | |
| Install and set up database: | |
| $ sudo apt-get install python-pysqlite2 sqlite3 | |
| $ sqlite3 thermo.db | |
| sqlite> create table thermo(sensor int, therm float, humi int, dtime int); |
This file contains hidden or 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 bash | |
| RAPPORT_URL="http://www.temperatur.nu/rapportera.php?hash=YOUR_TEMPERATUR_NU_API_KEY&t=" | |
| # My thermometer has ID 231, find yours with "tdtool -l" and replace 231 if needed. | |
| TEMP=$(tdtool -l| grep 231 | awk '{print $4}') | |
| RAPPORTERA=${RAPPORT_URL}${TEMP::-1} | |
| echo ${RAPPORTERA} >> tempnu.log | |
| curl -s "${RAPPORTERA}" >> tempnu.log |
This file contains hidden or 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 bash | |
| # Script for checking wifi connection on my headless, hidden, Raspberry Pi 2 | |
| # The idea is to reboot the RPi2 when network connection is lost, so it can come | |
| # up again. Making administration efforts minimal. | |
| # Crontab: | |
| # 0,10,20,30,40,50 * * * * /home/pi/checkwifi.sh | |
| logger -t checkwifi "Checking wifi" | |
| # Change 192.168.0.1 to your router IP-address, or use Google DNS 8.8.8.8 |
This file contains hidden or 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
| <?php | |
| // Dump the raw traffic from TellStick Duo to stdout | |
| $s = stream_socket_client('unix:///tmp/TelldusEvents'); | |
| while(1){ | |
| echo stream_socket_recvfrom($s,1024)."\n"; | |
| } |