Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / better_in_every_single_way.py
Last active August 29, 2015 14:00
Calculate partial product ordering over dictionaries of tuples assuming bigger numbers are better than smaller numbers, and strings are better than others if they have more of each character ("FFF" > "FF" but "FFF" ≯ "FA")
# Name (Def Def% MDef Mdef% Slots Links, Rate, Flags)
ff7_armor = {
"Bronze Bangle": (8, 0, 0, 0, 0, 0, 0, ""),
"Iron Bangle": (10, 0, 2, 0, 1, 0, 1, ""),
"Titan Bangle": (14, 2, 4, 0, 2, 0, 1, ""),
"Mythril Armlet": (18, 3, 8, 0, 2, 1, 1, ""),
"Carbon Bangle": (27, 3, 14, 0, 3, 1, 1, ""),
"Silver Armlet": (34, 4, 22, 0, 3, 1, 1, ""),
"Gold Armlet": (46, 4, 28, 0, 4, 2, 1, ""),
"Diamond Bangle": (57, 6, 37, 0, 5, 2, 1, ""),
@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
@badp
badp / gist:972197
Created May 14, 2011 13:10
moar crawl bling.css
#stats .bg10, /* health bar start */
#stats .bg1, /* mana bar start */
#stats .bg0 + .bg9, /* all mana recently used */
#stats .bg0 + .bg4, /* "all" health recently lost */
#thingadongdong
{
border-top-left-radius: 7px;
border-bottom-left-radius: 7px;
}