Skip to content

Instantly share code, notes, and snippets.

@upperhill
upperhill / sanitize.sh
Last active August 29, 2015 14:26 — forked from MoriTanosuke/sanitize.sh
Fix broken filenames. Removes all non-alphanumeric characters from directory and filenames from a given directory and copies them into the current directory. I'm using this to help me organize and backup my music on multiple devices.
#!/bin/bash
#
# Sanitizes all files in the given path
# and makes them lowercase too.
#
# param 1: source directory
# param 2: target directory
shopt -s extglob;
-- 1. apt-get install prosody-trunk
-- 2. Checkout prosody-modules on Google Code
-- 3. Move all modules to /usr/lib/prosody/modules
-- 4. Move the mod_smacks module to mod_smacks2 and copy it to mod_smacks3
-- 5. Move the files in mod_smacks* to match the new names
-- 6. In mod_smacks3/mod_smacks3.lua s/urn:xmpp:sm:2/urn:xmpp:sm:3/g
-- 7. Set the Prosody configuration to:
admins = { "ADMIN@HOST" }
daemonize = true
wget -qO- https://www.cloudflare.com/api.html?a=DIUP\&hosts=yourdomain.org\&u=cloudflare_userid\&tkn=cloudflare_apikey\&ip=`wget -qO- http://ip.skafari.com`
@upperhill
upperhill / ddns.sh
Last active August 29, 2015 14:24 — forked from lyoshenka/ddns.sh
#!/bin/bash
# Step 1: Fill in EMAIL, TOKEN, DOMAIN and SUBDOMAIN. Your token is here: https://www.cloudflare.com/my-account
# Step 2: Create an A record on Cloudflare with the subdomain you chose
# Step 3: Run "./ddns.sh -l" to get the rec_id of the record you created.
# Fill in REC_ID below
# Step 4: Run "./ddns.sh". It should tell you that record was updated or that it didn't need updating.
# Step 5: Run it every hour with cron. Use the '-s' flag to silence normal output
# 0 * * * * /path/to/ddns.sh -s
@upperhill
upperhill / ip-check-email.sh
Last active August 29, 2015 14:24
Send an email when IP address changes
#!/bin/bash
#http://www.tuxradar.com/answers/516
IPADDRESS=$(curl -s http://www.ipchicken.com/ | grep -o '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}')
if [[ "${IPADDRESS}" != $(cat ~/.current_ip) ]]
then
echo "Your new IP address is ${IPADDRESS}" |mail -s "IP address change" [email protected]
echo "Your new IP address is ${IPADDRESS}"
echo ${IPADDRESS} >|~/.current_ip
fi

Intro

The plan is to create a pair of executables (ngrok and ngrokd) that are connected with a self-signed SSL cert. Since the client and server executables are paired, you won't be able to use any other ngrok to connect to this ngrokd, and vice versa.

DNS

Add two DNS records: one for the base domain and one for the wildcard domain. For example, if your base domain is domain.com, you'll need a record for that and for *.domain.com.

Different Operating Systems

// 1. Open a photo set
// 2. Scroll to the bottom to see all photos
// 3. Run this script in javascript console
// => you will see all links to original files (now you can download it using DownThemAll!)
var jq = document.createElement('script');
jq.src = "//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js";
document.getElementsByTagName('head')[0].appendChild(jq);
photos = $('.photo-click');
@upperhill
upperhill / mt7601-raspberrypi.md
Last active May 30, 2022 20:03
148f:7601 Ralink Technology, Corp. Driver compile and install instructions for the raspberry pi B+

148f:7601 Ralink Technology, Corp.

To compile the driver, you need to have make and a compiler installed. In addition, you must have the kernel headers installed.

Determine what kernel version you're running.

uname -r 3.18.7+