Skip to content

Instantly share code, notes, and snippets.

View spvkgn's full-sized avatar

spvkgn

  • Russia
View GitHub Profile
@cdown
cdown / gist:1163649
Last active April 9, 2024 01:10
Bash urlencode and urldecode
urlencode() {
# urlencode <string>
old_lc_collate=$LC_COLLATE
LC_COLLATE=C
local length="${#1}"
for (( i = 0; i < length; i++ )); do
local c="${1:$i:1}"
case $c in
@vitex
vitex / via-ssh.sh
Created October 14, 2011 16:06
A script that uses redsocks to build a system-wide OpenSSH SOCKS proxy.
#!/bin/sh
########################################################################
#
# Usage: via-ssh.sh [-v] [-d] [USER@]SERVER[:PORT]
#
# -v Provide verbose output.
# -d Send all UDP on the DNS port 53 to 127.0.0.1.
# USER User name to use for SSH; default is current user.
# SERVER Server to use for SSH.
@guymac
guymac / setcover.cpp
Last active July 22, 2021 20:54
Embeds cover art in music files (MP3, M4A/AAC, Ogg/Vorbis)
/*
Command-line application for embedding JPEG cover art in MP3, MP4 and OGG audio files.
Based on taglib-1.7 (debian libtag1-dev)
and libb64 (http://libb64.sourceforge.net/) needed for OGG Vorbis embedded cover art
g++ -I/usr/local/include/taglib -L/usr/local/lib -ltag -lb64 setcover.cpp -o setcover
g++ -I/opt/homebrew/include/taglib -L/opt/homebrew/include/b64 -ltag -lb64 setcover.cpp -o setcover
*/
@bradleyayers
bradleyayers / gist:1660182
Created January 23, 2012 02:59
Save to `/etc/dbus-1/system.d/Upstart.conf` to enable Upstart user jobs
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE busconfig PUBLIC
"-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
<busconfig>
<!-- Only the root user can own the Upstart name -->
<policy user="root">
<allow own="com.ubuntu.Upstart" />
</policy>
@earthgecko
earthgecko / bash.generate.random.alphanumeric.string.sh
Last active April 2, 2024 15:59
shell/bash generate random alphanumeric string
#!/bin/bash
# bash generate random alphanumeric string
#
# bash generate random 32 character alphanumeric string (upper and lowercase) and
NEW_UUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
# bash generate random 32 character alphanumeric string (lowercase only)
cat /dev/urandom | tr -dc 'a-z0-9' | fold -w 32 | head -n 1
@brodul
brodul / streaming.sh
Created July 25, 2012 19:39
Twitch.tv script for streaming
#! /bin/bash
# originaly from http://tinyurl.com/twitch-linux from taladan
# www.youtube.com/user/taladan
# gist created by brodul
INRES="1280x800" # input resolution
#OUTRES="1024x640" # Output resolution
OUTRES="800x500" # Output resolution
@hydra1983
hydra1983 / ssh-tunnel
Last active May 2, 2018 09:26
script to start a ssh tunnel using autossh on ubuntu
#! /bin/sh
#
# Author: Edison <hydra1983@gmail.com>
#
# This is a modified version for from Andreas Olsson <andreas@arrakis.se>
# For each tunnel; make a uniquely named copy of this template.
## SETTINGS
#
# autossh monitoring port (unique)
@rcknr
rcknr / urlencode.sh
Created January 8, 2013 21:39
Simplistic URL encoding for Busybox shell.
#!/bin/sh
echo "$@" | awk -v ORS="" '{ gsub(/./,"&\n") ; print }' | while read l;
do
case "$l" in
[-_.~a-zA-Z0-9] ) echo -n ${l} ;;
"" ) echo -n %20 ;;
* ) printf '%%%02X' "'$l"
esac
done
@xiaods
xiaods / tiny-rss-openshift-setup.md
Last active January 2, 2019 17:06
Google reader have gone, Setting Up Your Free Private Feed Reader.使用OpenShift的免费空间,配合Tiny-Tiny-Rss直接部署一个在线版的Rss Reader,经试用,支持中文挺好的。
  1. 下载tiny-tiny-rss source code
cd ~/src/git 
clone git://github.com/gothfox/Tiny-Tiny-RSS.git
  1. 创建openshift空间
#!/usr/bin/php
<?php
/* Transmission to Deluge export script
*
* Transmission - transmission-gtk 2.77 (14031)
* Deluge - deluge: 1.3.6
* Script - PHP 5.4.14 (cli)
*
* How to use this script;
* 1) Run `php trans_to_deluge.php` and make sure there aren't any errors.