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.
$ python -m SimpleHTTPServer 8000
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 |
# | |
# NB : this is not secure | |
# from http://code.activestate.com/recipes/266586-simple-xor-keyword-encryption/ | |
# added base64 encoding for simple querystring :) | |
# | |
def xor_crypt_string(data, key='awesomepassword', encode=False, decode=False): | |
from itertools import izip, cycle | |
import base64 | |
if decode: |
package main | |
import ( | |
"log" | |
"net/http" | |
"net/http/httputil" | |
"net/url" | |
) | |
func main() { |
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.
$ python -m SimpleHTTPServer 8000
// Examples for using socat (and filan) | |
//"$" means normal user, "#" requires privileges, "//" starts a comment | |
/////////////////////////////////////////////////////////////////////////////// | |
// similar to netcat | |
// connect to 10.1.1.1 on port 80 and relay to and from stdio | |
$ socat - TCP:10.1.1.1:80 # similar to "netcat 10.1.1.1 80" |
import multiprocessing | |
# split a list into evenly sized chunks | |
def chunks(l, n): | |
return [l[i:i+n] for i in range(0, len(l), n)] | |
def do_job(job_id, data_slice): | |
for item in data_slice: | |
print "job", job_id, item |
# taken from http://www.piware.de/2011/01/creating-an-https-server-in-python/ | |
# generate server.xml with the following command: | |
# openssl req -new -x509 -keyout server.pem -out server.pem -days 365 -nodes | |
# run as follows: | |
# python simple-https-server.py | |
# then in your browser, visit: | |
# https://localhost:4443 | |
import BaseHTTPServer, SimpleHTTPServer | |
import ssl |
REM Para unir dos documentos diferentes podemos ejecutar lo siguiente desde la consola: | |
pdftk archivo1.pdf archivo2.pdf cat output salida.pdf | |
REM Tambien podemos unirlos utilizando etiquetas: | |
pdftk A=archivo1.pdf B=archivo2.pdf cat A B output salida.pdf | |
REM Y por supuesto podemos usar comodines: | |
pdftk *.pdf cat output salida.pdf | |
REM Para separar páginas de varios documentos y crear un documento nuevo con estas hacemos lo siguiente: |
$ sudo apt-get install linux-headers | |
$ sudo ln -s /usr/src/linux-headers-3.10-3-rpi/ /lib/modules/3.10.25+/build | |
$ git clone https://github.com/lwfinger/rtl8188eu.git | |
$ cd rtl8188eu | |
$ make all | |
$ sudo make install | |
$ sudo ifconfig wlan0 up |
1.json
contains data retrieved from the Instagram API. data
is an array of media matching the query posted to Instagram's REST API, in a JSON array..data[]
loops over each media object in the JSON file, letting us process each element|
works like a regular *nix pipe, taking the output of the previous operator and passing it on to the next one.select()
filters through objects depending on the rule passed to it..tags[]
returns an array of tags for each media. contains()
returns true if the current object passed to it contains the string passed as a parameter. .tags[] | contains("100happydays")
iterates over all the tags associated with the media object and returns true if the current tag matches the string 100happydays
..select( .tags[] | contains("100happydays") )
filters all media objects that contain the tag 100happydays
.images.standard_resolution.url
now