Skip to content

Instantly share code, notes, and snippets.

@badp
badp / spam.py
Created November 11, 2010 14:19
Send a message to all users on a system. Depends on the `libnotify-bin` package.
We couldn’t find that file to show.
@badp
badp / 0.md
Last active December 20, 2019 15:37
awful code done quick
@badp
badp / Pipfile
Last active July 6, 2019 10:49
poetrade is down
[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true
[dev-packages]
ipython = "*"
pylint = "*"
[packages]
@badp
badp / trueskill.py
Created June 21, 2010 07:41
An iffy, unaccurate, limited trueskill implementation of TrueSkill in Python.
from math import *
from math import pi as π
from pprint import pprint
games = [
("PK", "SF"), ("RT", "XT"), ("ACE", "BS"), ("SRM", "GB"), #day 1
("SysX", "XT"), ("PK", "RT"), ("SF", "GB"), ("SRM", "BS"), #day 2
("SysX", "GB"), ("RT", "BS"), ("SF", "SRM"), ("XT", "ACE"), #day 3
("SysX", "PK"), ("RT", "SF"), ("XT", "BS"), ("GB", "SRM"), #day 4
("SysX", "RT"), ("PK", "ACE"), ("XT", "SF"), ("BS", "GB"), #day 5
@badp
badp / cs.fish
Last active August 23, 2016 14:11
Hastily hacked together color highlighting for csearch
function cs -a term
csearch -n -- $term \
| env GREP_COLORS='mt=02;35' grep --color=always -P '^[^:]+:[^:]+:' \
# http://unix.stackexchange.com/a/305262/2179
| env grep --color=always -P -- $term \
| less -RFX
end
@badp
badp / xen_cpuid_verify.py
Created August 27, 2013 13:34
Check XEN CPUIDs for vailidity. I didn't end up using this code, so here it is under the WTFPL.
import re
import unittest
def IsValidXenCPUID(cpuid_mask):
# host(,[0-9a-z]+=([a-z]|[0-9])+)*
libxl_syntax = re.compile(r"""
host #required header
( #plus many of the following:
, #comma separator
[0-9a-z]+ #field name
"""
This is terribly written but still it should give you a broad idea of whether or not a gun is better than the other or not.
This keeps track of:
* Damage
* Fire rate
* Reload time
* Magazine
* Elemental damage
* Damage type (vs flesh, shield, armor)
@badp
badp / youtube_cleanser.js
Created April 29, 2012 18:26
Enough with people reuploading others' stuff on their own Youtube channels.
badChannels = ["gamehelper", "gamerspawn", "machinima", "vaivecorporation", "loquendoitalia", "patron500", "jon3pnt0"]
$(jQuery.grep($(".video-list-item, .result-item, .result-item-main-content, .sidebar-ads, .yt-tile-default"),
function(item, number){
//filter regular videos
username = $(item).find(".yt-user-name").text().toLowerCase();
console.debug(username)
if(badChannels.indexOf(username) != -1) return true;
//perhaps it's an ad.
@badp
badp / balsamiq mockup
Created March 8, 2012 11:13
TF2WH eternal overstock suggestion
<mockup version="1.0" skin="sketch" measuredW="962" measuredH="562" mockupW="902" mockupH="542">
<controls>
<control controlID="36" controlTypeID="com.balsamiq.mockups::Canvas" x="60" y="20" w="700" h="542" measuredW="100" measuredH="70" zOrder="0" locked="false" isInGroup="-1"/>
<control controlID="37" controlTypeID="com.balsamiq.mockups::Title" x="75" y="35" w="-1" h="-1" measuredW="180" measuredH="41" zOrder="1" locked="false" isInGroup="-1">
<controlProperties>
<size>32</size>
<text>The%20Cat%20Hat</text>
</controlProperties>
</control>
<control controlID="38" controlTypeID="com.balsamiq.mockups::Title" x="75" y="76" w="-1" h="-1" measuredW="119" measuredH="24" zOrder="2" locked="false" isInGroup="-1">
@badp
badp / crafting.txt
Created July 11, 2011 23:06
crafting.plantuml
@staruml
version
@enduml
@startuml weapons2.svg
title Last updated January 17th 2012.
hide empty members