Skip to content

Instantly share code, notes, and snippets.

@BenTheHokie
BenTheHokie / wordmap.csv
Created May 29, 2019 22:35
Phonetically correct word scrambler
I EIGH
J DGE
U OU
S ZE
T TTE
TH CHTH
R EUR
EW IEU
U OU
P PPE
@BenTheHokie
BenTheHokie / pageeval.py
Created June 6, 2015 15:44
Kamkar.....
#!/usr/bin/env python
import re
import urllib2
page0 = urllib2.urlopen('http://www.samy.pl/').read()
source = re.search('\\*\\/\\/([ \t]+)',page0).group(1)
source = source.replace(' ','0').replace('\t','1')
html = ""
@BenTheHokie
BenTheHokie / Getting IP with regex
Created May 8, 2015 02:01
The mystical magical regex
#!/usr/bin/env python3
import re, os
def getIP():
jargon = os.popen('/sbin/ip -o -4 addr list').read().split('\n')
getip = re.compile('[0-9]+: (?P<conn>[A-Za-z0-9]+)( +)inet (?P<addr>([12]?([0-9])+\.){3}([12]?([0-9])+)/[0-9]{1,2})')
retval = []
for a in jargon:
tmp = getip.search(a)
if tmp:
#!/usr/bin/env python
from bs4 import BeautifulSoup
import urllib
import re
r = urllib.urlopen("http://www.housing.umich.edu/files/helper_files/js/xml2print.php?location=MARKETPLACE&date=today&html=undefined").read()
xp = re.compile("<a class=\"info\" HREF=\"#\">.+<span>")
strfood = [BeautifulSoup(b).text for b in xp.findall(r)]
@BenTheHokie
BenTheHokie / div hell
Created January 8, 2015 23:03
muh divs
</tbody>
</table>
<div class="container-fluid whitetxt phoneform">
<form class="form-horizontal" role="form">
<div class="form-group">
<label Class="control-label col-xs-2 col-lg-4" for="phone">Phone Number:</label>
<div class="col-xs-10 col-lg-8">
<div class="input-group">
<input type="tel" class="form-control" id="phone" placeholder="No spaces or punctuation. Only numbers.">
<div class="input-group-btn">
@BenTheHokie
BenTheHokie / pmlame.js
Created July 25, 2012 02:29
TTapi detecting if someone lames
bot.on('update_votes', function(data) {
if (data.room.metadata.votelog[0][1] == 'down') {
bot.pm('Someone lamed the song!','4e41eadea3f7517bc60595bb')
}
});
@BenTheHokie
BenTheHokie / cts_script.py
Created July 13, 2012 22:34
Script will ask if you want to use the saved playlist and will ask for the song and match.
# matching script
from printnesteddictionary import print_dict
import re
import random
import unicodedata
import pickle
plDir = 'directory to save file'
playlist = []
@BenTheHokie
BenTheHokie / secsToHMS.py
Created July 8, 2012 03:57
A hour minute second converter for seconds to just about whatever you want
def secsToHMS(totsecs):
def plVal(num):
if abs(num)==1:
return ''
else:
return 's'
secs = totsecs%60
totmins = (totsecs - secs)/60
hrs = (totmins - totmins%60)/60
mins = totmins - hrs*60