Skip to content

Instantly share code, notes, and snippets.

@roylez
roylez / adblockupdater.sh
Last active March 9, 2016 18:34 — forked from Holzhaus/adblockupdater.sh
Adblock script for OpenWRT
# Adblock script for OpenWRT
# (c) 2015 by Roy Zuo
#
# This is another adblocker script for OpenWRT. Simply run this script as a
# daily cronjob on your OpenWRT-router. This works since OpenWRT
# revision 39312 [1] and does not manipulate any files in /etc/.
# Instead, this adds the adblock serverlist as a separate file
# to /tmp/.
#
# Use this file with Unbound DNS resolver.
@roylez
roylez / backup-db.sh
Created August 22, 2017 22:23
dokku postgres backupscript
#! /bin/bash
#
# to restore:
# gunzip XXX.db.gz
# dokku postgres:import <dbname> < XXX.db
# directory to save backups in, must be rwx by postgres user
BASE_DIR="/var/backups/postgres"
YMD=$(date "+%Y-%m-%d")
DIR="$BASE_DIR"
#!/bin/bash
#
for i in *; do
echo $i
cat $i |awk "/^$1/ { s=1 }; s == 1; s==1 && /^}/ { s=0 }"
done
// ==UserScript==
// @name SFreadability
// @namespace http://tampeGonkey.net/
// @version 0.96
// @history 0.96 add back "close case" button
// @history 0.95 some UI adjustments
// @history 0.94 some UI adjustments
// @history 0.93 make word breaking less aggressive
// @history 0.92 more UI adjustments
// @history 0.91 many inline image display fixes
#!/usr/bin/env ruby
# encoding: utf-8
#
# Vagrantfile to bring up one or more VM for testing purposes.
#
# Environment Variables:
#
# LAB_MACHINES: Number of machines, ignored if `machines.yml` exits
# LAB_MEMORY: Memory in GB each machine, default: 1, ignored if `machines.yml` exists
# LAB_CPU: Number of CPU each machine, default: 1, ignored if `machines.yml` exists
// ==UserScript==
// @name SFComment
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Some SF comment window hacks
// @author roylez
// @include https://canonical*.visual.force.com/servlet/servlet.Integration*
// @license MIT
// @require https://code.jquery.com/jquery-2.2.4.min.js
// @updateURL https://gist.github.com/8633e9b59406030f9c297b3e54e97e7b/raw/SFComment.user.js
// ==UserScript==
// @name LASidebarClose
// @namespace http://tampermonkey.net/
// @version 0.11
// @description try to take over the world!
// @author roylez
// @match https://linuxacademy.com/cp/courses/lesson/course/*/lesson/*
// @updateURL https://gist.github.com/4b2179d2b44a6f82705d927f16f75fe1/raw/LASidebarClose.user.js
// @downloadURL https://gist.github.com/4b2179d2b44a6f82705d927f16f75fe1/raw/LASidebarClose.user.js
// @grant none
// ==UserScript==
// @name B525s-65a_show_DNS
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Show DNS settings on Optus Huawei B525s-65a
// @author You
// @match http://192.168.0.1/html/dhcp.html
// ==/UserScript==
(function() {
#!/bin/zsh
# clean up
rm -rf ~/Downloads/wallpaper*.jpg
# <div class="img_cont" style="background-image: url(/th?id=OHR.SpeedFlying_EN-AU4701306692_1920x1080.jpg&amp;rf=LaDigue_1920x1080.jpg)">
URL=https://bing.com
img=$HOME/Downloads/wallpaper-$(date +%Y%m%d).jpg
img_path=$( curl --silent -L $URL | sed -n 's:.*rel="preload" *href="\(/th[^&]*.jpg\)&.*:\1:p' )
img_url=${URL}${img_path}
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.