Skip to content

Instantly share code, notes, and snippets.

@sente2
sente2 / pkginfo.sh
Created November 23, 2015 08:13 — forked from sente/pkginfo.sh
#!/bin/sh
# stuart powers
# list the files installed from a specific package or all
# packages which match /pattern/ # one line of output per file:
# [exe|dir|pipe|etc] $PACKAGE $FILE
#to see all the executable files from libwww-perl:
#stu@sente ~ $ pkginfo.sh libwww-perl | grep ^x | cut -f3
# /usr/bin/lwp-download
@sente2
sente2 / id_rsa.pub
Created November 23, 2015 08:13 — forked from sente/id_rsa.pub
id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAIBJNXmgPkbvgLx+ntGD55ON6fPwXKWIy+ah475VHip6Pdr3QWQSo0VdB8cheRwrDys0wVotWxd4ZufeNCJEGNUR2NWFYXfWYpC8hbtga/RlH/GhfcvJW4wlg4vBXBbwBl5kLRRQo6FfgqJlXeVq6gQINEogm4EnXQ+Wo8RxXOIzRQ== rsa-key-20060627
import codecs
def unicode_safe_127(ss, debug=False):
"""safely handle strings with have ordinal values greater than 127
by escaping each value as appropriate.
if debug=True, log each conversion to stderr
"""
mys = ss
tos=[]
for i,s in enumerate(mys):
@sente2
sente2 / gist_commandline.py
Created November 23, 2015 08:13 — forked from sente/gist_commandline.py
gist from the commandline
#!/usr/bin/env python
import getpass, mechanize, optparse, os.path, sys
parser = optparse.OptionParser()
parser.add_option('--login')
parser.add_option('--password')
parser.add_option('--filename')
parser.add_option('--description')
parser.add_option('--private', action='store_true', default=False)
@sente2
sente2 / python_snippets.py
Created November 23, 2015 08:13 — forked from sente/python_snippets.py
various snippets I've written or copied (and hopefully attributed)
#!/usr/bin/python
# from reddit --------------------------------------------
def traceit(fn):
import sys
def new_fn(*a,**kw):
ret = fn(*a,**kw)
sys.stderr.write("Fn: %s; a=%s; kw=%s\nRet: %s\n"
% (fn,a,kw,ret))
return ret
@sente2
sente2 / imaplib_connection.py
Created November 23, 2015 08:13 — forked from sente/imaplib_connection.py
imaplib_connection class
#taken from Doug Hellman's PyMOTW
import imaplib
import ConfigParser
import os
def open_connection(verbose=False):
# Read the config file
config = ConfigParser.ConfigParser()
config.read([os.path.expanduser('~/.pymotw')])
@sente2
sente2 / twisted_portscan.py
Created November 23, 2015 08:13 — forked from sente/twisted_portscan.py
scan for open ports
from twisted.internet import reactor, defer
from connectiontester import testConnect
def handleAllResults(allResults, ports):
for port, results in zip(ports, allResults):
success, result = results
if success:
print "Connected to port %i" % port
reactor.stop()
@sente2
sente2 / portscan.py
Created November 23, 2015 08:13 — forked from sente/portscan.py
scan for open ports
#!/usr/bin/python
import sys
import socket
try:
server = sys.argv[1]
except:
server = "localhost"
for x in range(10000):
@sente2
sente2 / home-snapshot.sh
Created November 23, 2015 08:13 — forked from sente/home-snapshot.sh
script used for localized snapshots
PATH=$PATH:bin/
set -x
cd $HOME || exit 1
DIR=.hide/proc/snapshots
if [ ! -d ${DIR}/daily.0 ]; then exit 1; fi
cp -al ${DIR}/daily.0 ${DIR}/daily.`date +%F`
@sente2
sente2 / reddit.html
Created November 23, 2015 08:13 — forked from sente/reddit.html
An example of a retrieving data from reddit's JSON(p) api using jquery
<!DOCTYPE html>
<!--
Stuart Powers
http://sente.cc/
http://twitter.com/stuartpowers
-->
<html>
<head>