Skip to content

Instantly share code, notes, and snippets.

View rringler's full-sized avatar

Ryan Ringler rringler

  • Google
  • San Francisco, CA
View GitHub Profile
@rringler
rringler / adblocker.sh
Last active September 19, 2016 03:21
adblocker.sh - adapted for dd-wrt
#!/bin/sh
# adblocker.sh - by Todd Stein (toddbstein@gmail.com), Saturday, October 25, 2014
# for use on routers running OpenWRT firmware
# Periodically download lists of known ad and malware servers, and prevents traffic from being sent to them.
# This is a complete rewrite of a script originally written by teffalump (https://gist.github.com/teffalump/7227752).
HOST_LISTS="
10 3 * * 1,3,5 /tmp/custom.sh
#!/usr/bin/env bash
http GET http://192.168.10.80:88/cgi-bin/CGIProxy.fcgi \
'usr'=='admin' \
'pwd'=='${FOSCAM_PASSWORD}' \
'cmd'=='setAudioAlarmConfig' \
'isEnable'==0 \
'sensitivity'==1 \
'linkage'==138 \
'triggerInterval'==10 \
#!/usr/bin/env bash
http GET http://pav.linkpc.net:881/cgi-bin/CGIProxy.fcgi \
'usr'=='admin' \
'pwd'=='${FOSCAM_PASSWORD}' \
'cmd'=='setAudioAlarmConfig' \
'isEnable'==1 \
'sensitivity'==1 \
'linkage'==138 \
'triggerInterval'==10 \
@rringler
rringler / new_method.rb
Last active September 19, 2016 17:11
Case Insensitive String Matching
# Create a new predicate method
#
# Eg., 'ABC'.similar?('abc') # true
#
# Pros: Simple. Intention-revealing.
# Cons: No sugar.
module CoreExtensions
module String
def similar?(value)
@rringler
rringler / lpass-ssh
Created September 26, 2016 16:50
lpass-ssh
#!/bin/bash
# https://luzifer.io/blog/using-lastpass-to-unlock-ssh-keys/
KEY_NAME=$1
if ! ( which lpass > /dev/null ); then
echo "LastPass CLI is required."
exit 2
fi
@rringler
rringler / bottom_collapse_button.css
Last active December 13, 2016 02:26
Reddit CSS to add a collapse button to the bottom of comments
.entry { position: relative; }
.entry > p > a.expand:hover:after { background: #369; }
.entry > p > a.expand:after {
content: '[–]';
position: absolute;
bottom: 12px;
right: 10px;
font-family: verdana, arial, helvetica, sans-serif;
font-size: 10px;
font-variant: normal;
@rringler
rringler / memoizable.rb
Created April 23, 2017 21:46
Simple module for memoizing Ruby methods
module Memoizable
# Usage:
#
# class Foo
# extend Memoizable
#
# memoize def bar
# 'bar'
# end
# end
import Ember from 'ember';
export default Ember.Component.extend({
agentCount: null,
didInsertElement() {
const comp = this;
let values$ = Bacon.fromEvent(this, 'test');
@rringler
rringler / hs100.sh
Created August 27, 2017 20:12
Shell Script to control a TP-Link HS100 Smart Outlet
#!/bin/bash
##
# Controls TP-LINK HS100,HS110, HS200 wlan smart plugs
# Tested with HS100 firmware 1.0.8
#
# Credits to Thomas Baust for the query/status/emeter commands
#
# Author George Georgovassilis, https://github.com/ggeorgovassilis/linuxscripts