Skip to content

Instantly share code, notes, and snippets.

View sparr's full-sized avatar

Clarence "Sparr" Risher sparr

  • Amazon
  • Whitinsville, MA, USA
View GitHub Profile
#!/usr/bin/env python
import os
import time
import requests
from bs4 import BeautifulSoup
import re
if os.path.exists('bots'):
os.rename('bots','bots_bak_'+str(time.time()))
@sparr
sparr / gist:fb8050b6c45ffcff1a7b
Created November 20, 2014 21:45
dspam.debug upon arrival of email whose signature does not get saved to dspam_signature_data table
5398: [11/20/2014 13:34:09] connection id 35 from 123.45.67.62.
5398: [11/20/2014 13:34:09] checking trusted user list for dspam(108)
5398: [11/20/2014 13:34:09] No QuarantineAgent option found. Using standard quarantine.
5398: [11/20/2014 13:34:09] using database handle id 5
5398: [11/20/2014 13:34:09] handle locked
5398: [11/20/2014 13:34:09] DSPAM Instance Startup
5398: [11/20/2014 13:34:09] input args: dspam --deliver=innocent
5398: [11/20/2014 13:34:09] pass-thru args:
5398: [11/20/2014 13:34:09] processing user user@domain.com
5398: [11/20/2014 13:34:09] uid = 108, euid = 108, gid = 115, egid = 115
@sparr
sparr / ssh_many_echo.sh
Created January 6, 2015 16:50
run sudo command with privileged pipe output on multiple servers via ssh
for i in SERVER1 SERVER2 SERVER3
do
echo $i
ssh -o LogLevel=quiet -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no $i "echo PASSWORD | sudo -S sh -c 'echo LINE1 > /privileged/file' "
echo
ssh -o LogLevel=quiet -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no $i "echo PASSWORD | sudo -S sh -c 'echo LINE2 >> /privileged/file' "
echo
ssh -o LogLevel=quiet -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no $i "echo PASSWORD | sudo -S sh -c 'echo LINE3 >> /privileged/file' "
echo
echo done
@sparr
sparr / professions.diff
Last active August 29, 2015 14:17
Cataclysm profession comparisons, Survivor baseline
archaeologist.json
{
- name: "Survivor"
+ name: "Archaeologist"
- pointcost: 0
+ pointcost: 5
- skillpoints: 0
+ skillpoints: 2
items: [
- "boots_winter"
* Adding handle: conn: 0x7fd47a804000
* Adding handle: send: 0
* Adding handle: recv: 0
* Curl_addHandleToPipeline: length: 1
* - Conn 0 (0x7fd47a804000) send_pipe: 1, recv_pipe: 0
* About to connect() to www.nike.com port 80 (#0)
* Trying 23.218.119.101...
* Connected to www.nike.com (23.218.119.101) port 80 (#0)
> GET / HTTP/1.1
> User-Agent: curl/7.30.0
@sparr
sparr / gist:9002acb015bb1e5cf37c
Created April 9, 2015 19:07
CDDA strength effects
Effects of Strength:
activity_handlers.cpp
activity_handlers::butcher_finish
151: strength below 4 incurs a butcher skill check penalty
activity_handlers.cpp
activity_handlers::pulp_do_turn
770: increases pulp damage
772: increases pulp damage cap
@sparr
sparr / armor_stats.jq
Created November 27, 2015 18:56
cataclysm armor stats json jq script
# Output stats for armor, including resistance calculations
# jq -f armor_stats.jq --argfile mat ../materials.json ../items/*.json
# load bash and cut resist data from the material array
( $mat | map ( { (.ident):.bash_resist } ) | add ) as $br
|
( $mat | map ( { (.ident):.cut_resist } ) | add ) as $cr
# now, $br and $cr are objects mapping materials to bash/cut resist values
# like this {plastic:2, paper:1, ...}
@sparr
sparr / keybase.md
Created February 7, 2016 23:56
keybase.md

Keybase proof

I hereby claim:

  • I am sparr on github.
  • I am sparr (https://keybase.io/sparr) on keybase.
  • I have a public key whose fingerprint is 4C43 B68A B0A8 D111 58A6 1710 92C1 78D0 1CD2 F116

To claim this, I am signing this object:

local function key_in_tbl(key,tbl)
for k,v in pairs(tbl) do
if k == key then return true end
end
return false
end
local fluid_items = {}
for name,item in pairs(data.raw.item) do
@sparr
sparr / clear_timers.js
Last active March 12, 2017 15:57
clear active timers in Javascript
for (handle of process._getActiveHandles()) {
// if (handle instanceof Timer) { // doesn't work because Timer isn't defined, even though handle.constructor.name=="Timer"
if ('_list' in handle) {
for (timername in handle._list) {
clearTimeout(handle._list[timername]);
}
}
}