Skip to content

Instantly share code, notes, and snippets.

@hrwgc
hrwgc / validate.sh
Created November 13, 2013 19:57
bash wget - check if file exists at url before downloading
#!/bin/bash
# simple function to check http response code before downloading a remote file
# example usage:
# if `validate_url $url >/dev/null`; then dosomething; else echo "does not exist"; fi
function validate_url(){
if [[ `wget -S --spider $1 2>&1 | grep 'HTTP/1.1 200 OK'` ]]; then echo "true"; fi
}
@nukeador
nukeador / DNS tunneling with iodine.md
Last active April 8, 2024 22:39
How to install and use iodine for DNS tunneling.

This guide provides detailed steps for setting up DNS records, configuring a DNS tunneling server and client, and setting up a browser for secure proxy connections.

Why iodine?

  • Bypassing Network Restrictions: iodine excels in environments with strict network restrictions. It utilizes DNS queries, which are typically allowed through firewalls, to tunnel data where traditional methods like VPNs might be blocked.
  • Efficient for Limited Bandwidth: Ideal for situations with bandwidth limitations, iodine requires less bandwidth compared to standard VPNs, making it a practical choice for networks with restricted data flow.
  • Customizability and Open Source: As an open-source tool, iodine offers extensive customization options. Users with specific technical needs or those interested in a hands-on approach to network tunneling can tailor iodine to their requirements.

Prerequisites

@ohhdemgirls
ohhdemgirls / vidble.sh
Created January 20, 2014 02:49
Simple Vidble.com Album Downloader
#!/bin/bash
id="$1"
host="http://vidble.com/album/"
mkdir "$id"
wget -nv -O - "$host$id" |grep -e "<img src='" |grep -Eo '/[^" ]+(jpg|jpeg|JPG|GIF|gif|PNG|png)' |sed -e 's/_med//' -e 's@^@http://vidble.com@' > $id/links.txt
sed -i '/logo/d' $id/links.txt
wget -i $id/links.txt -P $id
@ohhdemgirls
ohhdemgirls / rename.sh
Last active January 4, 2016 10:49
Rename html files based on title tag
#!/bin/bash
# Rename the ouput html file from redditPostArchiver with the reddit thread title.
# https://github.com/sJohnsonStoever/redditPostArchiver
for f in *.html;
do
title=$( awk 'BEGIN{IGNORECASE=1;FS="<title>|</title>";RS=EOF} {print $2}' "$f" )
mv -i "$f" "${title//[^a-zA-Z0-9\._\- ]}_$f"
@xr09
xr09 / ubackup.sh
Last active January 4, 2016 20:29
Minimal rotating backup system
#!/usr/bin/bash
backup_number=8
base_name="backup.gz"
backup_path="/opt/somebackup/"
cd $backup_path
# clean any old temp backup
#!/bin/sh
# Quickly delete all traces of a user from the database and filesystem
# usage: ./deluser.sh username
USER=$1
USERID=`sqlite3 ../database.db "select id from users where username = '${USER}'"`
for table in albums comments images posts; do
sqlite3 ../database.db "delete from ${table} where userid = ${USERID}"
done
@chergaoui
chergaoui / Extract frame from video
Created February 19, 2014 16:38
Quick script I recently used to extract a frame from a .webm file. The frame is saved as a .png file.
#!/bin/bash
# NB: the script file must be in the same directory as media files
FILES=./*.webm
for f in $FILES
do
echo "Processing $f file..."
ffmpeg -i "$f" -ss 10 -vframes 1 "$f.png"
done
@GermainZ
GermainZ / clbin
Last active March 27, 2022 04:30
Upload text/images to clbin.com from the command line
#!/usr/bin/env bash
# Upload text/images to clbin.com from the command line
# License: ISC http://www.isc.org/downloads/software-support-policy/isc-license/
clip() {
if command -v xclip &> /dev/null; then
xclip -selection clip <<< "$@"
elif command -v xsel &> /dev/null; then
xsel -b -i <<< "$@"
fi
anonymous
anonymous / hooks.rb
Created February 25, 2014 22:42
require 'nokogiri'
module Try
def try(method, args = [])
if self.respond_to? method
self.send method, *args
end
end
end
@funkenstrahlen
funkenstrahlen / encode_to_mp4.sh
Last active August 29, 2015 13:56
A small script to convert all AVI files in a folder to mp4/h264
#!/bin/bash
#
# A small script to convert all AVI files in a folder to mp4 h264
# You can either use HandbrakeCLI or ffmpeg.
# ffmpeg requires to be compiled with libx264 which is not default in debian based distributions
#
# To use HandbrakeCLI do not forget to install the packages!
# For Linux Mint I had to do the following to get HandbrakeCLI running:
# sudo add-apt-repository ppa:stebbins/handbrake-snapshots
# sudo apt-get update