Skip to content

Instantly share code, notes, and snippets.

@ahmedelgabri
ahmedelgabri / gist:8122545
Last active December 22, 2020 08:46
Shell function to open a static server (Python, Ruby or PHP)

Static server shell function

A Modified function of Paul Irish's StaticServer shell function, according to this gist You can run static servers for many languages.

How it works

$ staticServer <lang> <port> #port is optional, default is 8000
@gizmaa
gizmaa / Plot_Examples.md
Last active May 15, 2025 02:57
Various Julia plotting examples using PyPlot
@willurd
willurd / web-servers.md
Last active May 15, 2025 16:42
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@rubiojr
rubiojr / openwrt_stats.rb
Created January 13, 2013 18:44
Getting OpenWRT router stats with ruby
require 'excon'
require 'pp'
require 'yajl'
# Auth parameters
username = 'root'
password = 'secret'
host = '192.168.1.1'
# Will parse returned JSON content
parser = Yajl::Parser.new
@vbajpai
vbajpai / opkgclean.sh
Last active April 3, 2025 19:22
If opkg runs out of space, it will not remove the files it was installing. Run this custom script in order recover the space by removing these files and the installed dependencies.
#!/bin/sh
#takes one argument/parameter: the name of the package which didn't install correctly and should be removed along with its dependencies
#do opkg update first
#example: ./opkgremovepartlyinstalledpackage.sh pulseaudio-daemon
#get list of all packages that would be installed along with package x
opkg update
PACKAGES=`opkg --force-space --noaction install $1 | grep http | cut -f 2 -d ' ' | sed 's/.$//'`
for i in $PACKAGES
do
@arjunvenkat
arjunvenkat / scraper_lab_p2.rb
Created December 12, 2012 17:48
scrape multiple pages using Nokogiri and Mechanize
# nokogiri requires open-uri
require 'nokogiri'
require 'open-uri'
# csv will be used to export data
require 'csv'
require 'mechanize'
# pp is useful to display mechanize objects
require 'pp'