Skip to content

Instantly share code, notes, and snippets.

@alganet
alganet / serve.sh
Last active July 17, 2020 05:42
Serve any folder as a web server with $ curl -L http://tinyurl.com/servesh1 | sh
#!/usr/bin/env sh
# serve.sh
# Modular version: https://gist.github.com/alganet/a22a1373dcee7c175d1e
# Expansion on zsh
command -v setopt 2>&1 >/dev/null && setopt SH_WORD_SPLIT
# POSIX on bash
export POSIXLY_CORRECT=1
# Lists files and folders as HTML
@duzun
duzun / enableSelect-bookmarklet.html
Last active December 22, 2023 08:04
Enable Right Click and Text Selection Bookmarklet
<a class="btn btn-default btn-info bookmarklet" href="javascript:(function(d){var a=d.document,h=function(){},c=a.body||a.getElementsByTagName("body")[0],f=a.documentElement||a.getElementsByTagName("html")[0],k=[c,f,a],l=["webkit","khtml","moz","ms",""],g=["contextmenu","selectstart","select","mousedown","mouseup"],b=d.Selection,e=b&&b.prototype;e&&(e.removeAllRanges=h,b=a.selection)&&(b.clear=h);for(e=k.length;e--;)if(f=k[e]){for(b=g.length;b--;)f["on"+g[b]]=null;if(a=f.style)for(a.cursor="",a.webkitTouchCallout="initial",b=l.length;b--;)a[((c=l[b])?"-"+c+"-":c)+"user-select"]="initial"}(c=d.jQuery||d.Zepto)&&c(d).off(g)})(this);">
Enable Select
</a>
@arulrajnet
arulrajnet / ChromeAppDownloader.py
Last active February 15, 2024 01:06
Python Script to download the Chrome Extensions (CRX) file directly from the google chrome web store.
# -*- coding: utf-8 -*-
"""
Python Script to download the Chrome Extensions (CRX) file directly from the google chrome web store.
Referred from http://chrome-extension-downloader.com/how-does-it-work.php
"""
from __future__ import division
import argparse
import requests
@mildred
mildred / download.sh
Created October 20, 2014 10:03
Download from archive.org Wayback Machine
#!/bin/bash
url=http://redefininggod.com
webarchive=https://web.archive.org
wget="wget -e robots=off -nv"
tab="$(printf '\t')"
additional_url=url.list
# Construct listing.txt from url.list
# The list of archived pages, including some wildcard url
@yurrriq
yurrriq / ipconfig.sh
Last active February 10, 2024 14:34
Get Public IP Address in Terminal
#!/bin/bash
# Slow
curl -s ifconfig.me | xargs echo -n
# Faster
curl -s icanhazip.com | xargs echo -n
# API: http://api.ident.me
@makefu
makefu / clbin
Last active August 29, 2015 14:04 — forked from GermainZ/clbin
updated clbin, supports images through pipe and images without extension
#!/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
}
@drakeguan
drakeguan / bootstrap_for_encoding_server.sh
Last active January 12, 2017 03:13 — forked from xdamman/install_ffmpeg_ubuntu.sh
Bash script to install latest version of ffmpeg, x264 and libvpx on Ubuntu 14.04 server
#!/bin/bash
# Bash script to install latest version of ffmpeg and its dependencies on Ubuntu 14.04
# Copyright @ 2014 Shuen-Huei (Drake) Guan <drake.guan@gmail.com>
# References:
# * https://gist.github.com/xdamman/e4f713c8cd1a389a5917
# * https://blog.dlasley.net/2013/05/install-ffmpeg-from-source/
# * http://fermat-little-theorem-blog.logdown.com/posts/203069-solved-when-building-gpac-suffer-usr-local-lib-libswscalea-error-adding-symbols-bad-value
@mxbees
mxbees / get-teh-clip.sh
Created July 5, 2014 11:44
clip movies
#!/bin/bash
echo "file name"
read name
#both the 'start' and 'end' variables should be time stamps of the format hh:mm:ss
echo "start of clip"
read start
echo "end of clip"
@xdamman
xdamman / install_ffmpeg_ubuntu.sh
Created July 2, 2014 21:03
Install latest ffmpeg on ubuntu 12.04 or 14.04
#!/bin/bash
# Bash script to install latest version of ffmpeg and its dependencies on Ubuntu 12.04 or 14.04
# Inspired from https://gist.github.com/faleev/3435377
# Remove any existing packages:
sudo apt-get -y remove ffmpeg x264 libav-tools libvpx-dev libx264-dev
# Get the dependencies (Ubuntu Server or headless users):
sudo apt-get update
@chrisveness
chrisveness / base64.js
Last active May 6, 2023 02:55
Encode/decode ASCII string to/from base64
/**
* Encode string into Base64, as defined by RFC 4648 [http://tools.ietf.org/html/rfc4648].
* As per RFC 4648, no newlines are added.
*
* Characters in str must be within ISO-8859-1 with Unicode code point <= 256.
*
* Can be achieved JavaScript with btoa(), but this approach may be useful in other languages.
*
* @param {string} str ASCII/ISO-8859-1 string to be encoded as base-64.
* @returns {string} Base64-encoded string.