Skip to content

Instantly share code, notes, and snippets.

Avatar

debedb debedb

View GitHub Profile
View gist:4b6249bebea8cd69366096aa85b4a088
import arrow
def perc(n):
try:
return "%0.1f" % (float(n)/tot*100)
except Exception, e:
raise Exception("Error in %s (%s): %s" % (n, type(n), e))
f = open('/tmp/rows.csv')
tot = 0
View jardiff.py
import argparse
import os
import sets
import subprocess
import sys
import tempfile
"""
Assumes procyon:
@debedb
debedb / dupes.py
Last active Dec 27, 2017
Find duplicate files
View dupes.py
#!/usr/bin/python
import pprint
import os
import sys
import hashlib
import sets
import argparse
import signal
@debedb
debedb / dhcp.conf
Created Aug 29, 2017
vmnet2 sample (/Library/Preferences/VMware Fusion/vmnet2/dhcd.conf)
View dhcp.conf
# Configuration file for ISC 2.0 vmnet-dhcpd operating on vmnet2.
#
# This file was automatically generated by the VMware configuration program.
# See Instructions below if you want to modify it.
#
# We set domain-name-servers to make some DHCP clients happy
# (dhclient as configured in SuSE, TurboLinux, etc.).
# We also supply a domain name to make pump (Red Hat 6.x) happy.
#
@debedb
debedb / etcdrmrf.sh
Created Aug 23, 2017
Remove everything from etcd
View etcdrmrf.sh
#!/bin/csh
foreach x (`etcdctl ls --recursive | sort -r | uniq`)
etcdctl rmdir $x
end
etcdctl ls --recursive /
@debedb
debedb / turbotaxfile.py
Last active Jul 16, 2017
Quick sort of receipts into folders based on TurboTax clasification
View turbotaxfile.py
import time
import os
import sys
import shutil
from subprocess import Popen
reader = 'open'
# Inventory, Taxes_and_Licenses, Advertising, Insurance, Interest,
# Rental, Commissions, Contract Labor, Repairs and Maintenance,
@debedb
debedb / formMarshaller.go
Created Nov 16, 2016
formMarshaller provides functionality to marshal/unmarshal data to/from HTML form format.
View formMarshaller.go
// formMarshaller provides functionality to marshal/unmarshal
// data to/from HTML form format.
type formMarshaller struct{}
func (j formMarshaller) Marshal(v interface{}) ([]byte, error) {
retval := ""
vPtr := reflect.ValueOf(v)
vVal := vPtr.Elem()
vType := reflect.TypeOf(vVal.Interface())
View GoClipse Code style
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<profiles version="12">
<profile kind="CodeFormatterProfile" name="GoClipse" version="12">
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_ellipsis" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_for_statment" value="common_lines"/>
<setting id="org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries" value="true"/>
@debedb
debedb / go_arrays_pointers.go
Created Mar 23, 2016
Go arrays and pointers
View go_arrays_pointers.go
// See https://play.golang.org/p/qK05tDYCFR
package main
import "fmt"
type Make struct {
Name string
}
@debedb
debedb / WrappedStreamingBody
Last active Nov 26, 2020
Wrap boto3's StreamingBody object to provide enough Python fileobj functionality fileobj functionality so that GzipFile is satisfied.
View WrappedStreamingBody
class WrappedStreamingBody:
"""
Wrap boto3's StreamingBody object to provide enough
fileobj functionality so that GzipFile is
satisfied. Sometimes duck typing is awesome.
You can’t perform that action at this time.