Skip to content

Instantly share code, notes, and snippets.

View recyclerobot's full-sized avatar

Thijs Bernolet recyclerobot

View GitHub Profile
@recyclerobot
recyclerobot / twitter_followers_phantomJS.js
Last active August 29, 2015 13:56
Twitter followers command line using PhantomJS
var usernames = [],
results = {},
page = require('webpage').create(),
system = require('system');
function init(){
if (system.args.length === 1) {
console.log('Pass one or more twitter usernames as arguments');
} else {
system.args.forEach(function (arg, i) {
@recyclerobot
recyclerobot / exec_php_phantom_write_to_file.php
Last active August 29, 2015 13:56
execute phantom script and write to txt file
<?php
$o = exec('./phantomjs get_twitter_followers.js weworkweplay');
$j = json_decode($o, true);
$fp = fopen('twitter_followers.txt', 'w');
fwrite($fp, $j["weworkweplay"]);
fclose($fp);
echo $o;
?>
# /etc/network/interfaces
auto wlan0
iface lo inet loopback
iface eth0 inet dhcp
allow-hotplug wlan0
iface wlan0 inet static
address 192.168.1.155
# /etc/wpa_supplicant/wpa_supplicant.conf
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="NYO_WWWP"
psk="topsecret"
proto=RSN
key_mgmt=WPA-PSK
<html>
<head>
<title>Canvas Boilerplate</title>
<style type="text/css">
*,html{
margin: 0;padding: 0;
}
canvas {
width: 100%;
@recyclerobot
recyclerobot / gist:9629768
Created March 18, 2014 21:12
Day/Night/Morning checker
var fs = require('fs')
, gm = require('gm');
var threshold = {
"night":
{
"from": 0,
"to": 10000
},
"morning":
@recyclerobot
recyclerobot / gist:9770207
Last active August 29, 2015 13:57
auto reboot on network fail
ping -c4 192.168.1.1 > /dev/null
if [ $? != 0 ]
then
sudo /sbin/shutdown -r now
fi
@recyclerobot
recyclerobot / gist:9806639
Created March 27, 2014 12:39
Restart network raspberry pi
ping -c4 192.168.1.1 > /dev/null
if [ $? != 0 ]
then
echo "No network connection, restarting wlan0"
/sbin/ifdown 'wlan0'
sleep 5
/sbin/ifup --force 'wlan0'
fi
int8_t sendATcommand(char* ATcommand, char* expected_answer, unsigned int timeout){
uint8_t x=0, answer=0;
char response[100];
unsigned long previous;
memset(response, '\0', 100); // Clean response buffer
delay(100); // Delay to be sure no passed commands interfere
sendATcommand("AT+CGPSURL=\"supl.google.com:7276\"","OK",1000); // sets GPS server
sendATcommand("AT+CGPSSSL=0","OK",1000); // without certificate