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
const rxjs = require('rxjs'); | |
/** | |
* The entrypoint function. Pass it the thing to call | |
*/ | |
function dynamicPoll(pollFunc/*, delayFunc*/) { | |
// A recursive stream, which triggers an API call | |
let i = 0; // just here for debugging | |
const trigger = new rxjs.BehaviorSubject(i++); |
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/sh | |
for FILE in `git diff-index --name-only HEAD --` ; do | |
# Check if the file contains 'debugger' | |
if cat $FILE | grep -q 'debugger' $FILE; then | |
echo $FILE ' contains debugger!' | |
exit 1 | |
fi | |
# Check if the file contains 'console.log' |
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/sh | |
# | |
# Automatically add branch name to every commit message except merge commits. | |
# | |
COMMIT_MSG=$1 | |
addBranchName() { | |
branchPath=$(git symbolic-ref -q HEAD) |
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 json | |
from datetime import datetime | |
data = {} | |
now = datetime.now() | |
data['general_state'] = 1 | |
data['year'] = now.year |
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 ruby | |
require 'json' | |
# | |
# Output with --simple looks like: | |
# Ping: 31.823 ms | |
# Download: 80.53 Mbit/s | |
# Upload: 11.25 Mbit/s | |
# | |
speed = `speedtest --simple` |
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 ruby | |
require 'json' | |
ALLOWED_CHANNELS = ['Ch 1', 'Ch 6', 'Ch 11'] | |
Infinity = Float::INFINITY | |
wifi = `iwlist wlan0 scan` | |
pieces2ghz = wifi.split("Cell ")[1..-1].select{|x| x.include?('Frequency:2') && x.include?('Channel ') } | |
data = pieces2ghz.map{ |x| [ x.split('Channel ')[1].split(')')[0].to_i, (x.split('Signal level=')[1].split('/')[0] rescue '0').to_i, (x.split('Protocol:')[1].split("\n")[0] rescue '[UNKNOWN]') ] } |
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 ruby | |
require 'json' | |
NORMAL = 1 | |
DEGRADED = 2 | |
EXCESSIVE = 3 | |
DOWN = 4 | |
def is_number? string | |
true if Float(string) rescue false | |
end |
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 ruby | |
require 'json' | |
wifi = `iwlist wlan0 scan` | |
pieces2ghz = wifi.split("Cell ")[1..-1].select{|x| x.include?('Signal level=')} | |
data = pieces2ghz.map{ |x| [(x.split('Signal level=')[1].split('/')[0] rescue '0').to_i ]} | |
signals = { :'Very Weak' => 0, :Poor => 0, :Fair => 0, :Strong => 0 } | |
signals = data.reduce(signals) do |signals, x| | |
if(x[0] > 70) |
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 ruby | |
require 'json' | |
wifi = `iwlist wlan0 scan` | |
pieces2ghz = wifi.split("Cell ")[1..-1] | |
data = pieces2ghz.map{ |x| [ (x.split('Protocol:')[1].split("\n")[0] rescue '[UNKNOWN]') ] } | |
protocols = data.reduce({}) do |protocols, x| | |
protocols[x[0]] = protocols[x[0]] ? protocols[x[0]] + 1 : 1 | |
protocols |
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 ruby | |
require 'json' | |
ALLOWED_CHANNELS = ['Ch 1', 'Ch 6', 'Ch 11'] | |
wifi = `iwlist wlan0 scan` | |
pieces2ghz = wifi.split("Cell ")[1..-1].select{|x| x.include?('Frequency:2') && x.include?('Channel ') } | |
data = pieces2ghz.map{ |x| [ x.split('Channel ')[1].split(')')[0].to_i, (x.split('Signal level=')[1].split('/')[0] rescue '0').to_i, (x.split('Protocol:')[1].split("\n")[0] rescue '[UNKNOWN]') ] } |
NewerOlder