Skip to content

Instantly share code, notes, and snippets.

@8bitDesigner
8bitDesigner / delta.js
Created July 24, 2014 23:28
Get the difference in styles between two HTML nodes
function styleDelta(a, b) {
var aStyles = window.getComputedStyle(a)
, bStyles = window.getComputedStyle(b)
, delta = {}
Object.keys(aStyles).forEach(function(key) {
var aVal = aStyles[key]
, bVal = bStyles[key]
if (aVal != bVal) {
@dstokes
dstokes / dns-check.sh
Created November 7, 2016 23:53
Test Dead Route53 DNS Records
#!/bin/bash
DOMAIN=$1
PORT=$2
TYPES=(A CNAME)
# resolve zone id
ZONE=$(aws route53 list-hosted-zones --query 'HostedZones[?Name==`'$DOMAIN'.`].Id' --output text)
if [[ -z "$ZONE" ]]; then
echo "Unrecognized domain: $1" >&2
@ssimunic
ssimunic / main.go
Last active February 16, 2020 22:12
Monitor web page changes with Go
package main
import (
"net/http"
"io/ioutil"
"time"
"log"
"os"
)
@AlexeyDemidov
AlexeyDemidov / defaults_unicorn_app
Last active March 24, 2021 07:34
Unicorn service file for systemd with rvm support
# save this file in /etc/default/unicorn_app
USER=app_user
APP_ROOT=/srv/app
RVM_STRING=2.2.4@app_gemset
RACK_ENV=production
UNICORN_OPTS="-D -c /srv/app/shared/config/unicorn.rb -E production"
DAEMON=unicorn
@Darksecond
Darksecond / nginx.conf
Created October 8, 2012 20:24
Systemd + Unicorn + Nginx + no-downtime-reload
# The only setting we feel strongly about is the fail_timeout=0
# directive in the "upstream" block. max_fails=0 also has the same
# effect as fail_timeout=0 for current versions of nginx and may be
# used in its place.
# you generally only need one nginx worker unless you're serving
# large amounts of static files which require blocking disk reads
worker_processes 1;
# # drop privileges, root is needed on most systems for binding to port 80
@oliveiraev
oliveiraev / youtube-downloader.sh
Last active July 20, 2022 08:42
Download youtube videos
#!/bin/bash
decode() {
to_decode='s:%([0-9A-Fa-f][0-9A-Fa-f]):\\x\1:g'
printf "%b" `echo $1 | sed 's:&:\n:g' | grep "^$2" | cut -f2 -d'=' | sed -r $to_decode`
}
data=`wget http://www.youtube.com/get_video_info?video_id=$1\&hl=pt_BR -q -O-`
url_encoded_fmt_stream_map=`decode $data 'url_encoded_fmt_stream_map' | cut -f1 -d','`
signature=`decode $url_encoded_fmt_stream_map 'sig'`
url=`decode $url_encoded_fmt_stream_map 'url'`
test $2 && name=$2 || name=`decode $data 'title' | sed 's:+: :g;s:/:-:g'`
@furious
furious / frs-vlc_twitch.lua
Last active January 10, 2023 07:05
VLC - Playlist Parser for Twitch streams/videos URLs
--[[
Resolve Twitch channel and video URLs to the actual media URL
Author: furious
How to install? https://wiki.videolan.org/Documentation:Building_Lua_Playlist_Scripts
Don't forget to remove the old "twitch.luac" plugin
OBS: You can choose which quality you want just add ":option" in the url.
If the option isn't available it will fallback to the best quality as normal.
You can also check the console log to see all available quality options.
#!/usr/bin/sudo ruby
#
# revealer.rb -- Deobfuscate GHE .rb files.
#
# This is simple:
# Every obfuscated file in the GHE VM contains the following code:
#
# > require "ruby_concealer.so"
# > __ruby_concealer__ "..."
@ItsAdventureTime
ItsAdventureTime / .rtorrent.rc
Created August 8, 2014 20:03
This an optimized version of the rTorrent configuration file.
#
#
# The Seedbox From Scratch Script
# By Notos ---> https://github.com/Notos/
#
#
######################################################################
#
# Copyright (c) 2013 Notos (https://github.com/Notos/)
#
@bryanjswift
bryanjswift / .rtorrent.rc
Created December 28, 2011 02:42
rtorrent configuration file with description
# This is an example resource file for rTorrent. Copy to
# ~/.rtorrent.rc and enable/modify the options as needed. Remember to
# uncomment the options you wish to enable.
# Maximum and minimum number of peers to connect to per torrent.
min_peers = 1
max_peers = 100
# Same as above but for seeding completed torrents (-1 = same as downloading)