Skip to content

Instantly share code, notes, and snippets.

View davydany's full-sized avatar
💭
Check out my app: The Civic Press! https://www.thecivicpress.com/

David Daniel davydany

💭
Check out my app: The Civic Press! https://www.thecivicpress.com/
View GitHub Profile
@davydany
davydany / show_map.py
Created September 26, 2012 17:06
Preparing data to plot contours in Matplotlib's Basemap
# More Info: http://davydany.com/post/32287214449/matplotlibs-basemap-plotting-a-list-of-latitude
def show_map(self, a):
# 'a' is of the format [(lats, lons, data), (lats, lons, data)... (lats, lons, data)]
lats = [ x[0] for x in a ]
lons = [ x[1] for x in a ]
data = [ x[2] for x in a ]
lat_min = min(lats)
lat_max = max(lats)
@davydany
davydany / .vimrc
Created January 14, 2014 04:44
My .vimrc
set nu
set smarttab
set expandtab
set autoindent
set nocompatible " choose no compatibility with legacy vi
syntax enable
set encoding=utf-8
set showcmd " display incomplete commands
filetype plugin indent on " load file type plugins + indentation
@davydany
davydany / .bashrc
Last active March 16, 2017 21:21
.bashrc
#########################################
## DAVID'S BASH_PROFILE
#########################################
# Sys Vars
user=''
pass=''
# XMLStarlet
@davydany
davydany / timeit.py
Created February 20, 2014 22:18
Timeit Method Decorator
import time
def timeit(func=None,loops=1,verbose=False):
if func != None:
def inner(*args,**kwargs):
sums = 0.0
mins = 1.7976931348623157e+308
maxs = 0.0
@davydany
davydany / dirxpath.sh
Created March 3, 2014 17:08
Rip through XML files in a Directory with XPATH query with XMLStarlet
## DirXPath
## --------
##
## Requirements:
## =============
## Ensure that XMLStarlet is installed on your machine (http://xmlstar.sourceforge.net/)
##
## Install
## =======
## Put the following in your .bashrc (Linux/Unix/Cygwin/MinGW) or .bash_profile (Mac) file. Then source the file.
@davydany
davydany / select_query_extractor.py
Last active August 29, 2015 14:01
Takes a log file with multipe SELECT query that was split across multiple lines, and extracts the SELECT query and prints it out on stdout.
"""
******************************************************************
WARNING: THIS DOES NOT TAKE INTO ACCOUNT NESTED SELECT QUERIES.
******************************************************************
Select Query query_extractor
============================
Takes a log file with multipe SELECT query that was split across
multiple lines, and extracts the SELECT query and prints it out on
@davydany
davydany / pom.xml
Created March 28, 2015 16:27
Hadoop Development - pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.davydany.hadoop</groupId>
<artifactId>MapReduce</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>MapReduce</name>
@davydany
davydany / Bash Colors
Last active August 8, 2022 22:09
log4bash :-D - Just putting colors for nice clean logs in bash
BLACK="\033[0;30m"
DARK_GRAY="\033[1;30m"
LIGHT_GRAY="\033[0;37m"
WHITE="\033[1;37m"
BLUE="\033[0;34m"
LIGHT_BLUE="\033[1;34m"
GREEN="\033[0;32m"
LIGHT_GREEN="\033[1;32m"
@davydany
davydany / roulette-sim.py
Last active August 29, 2015 14:22
roulette-sim.py
#!/usr/bin/python
import random
NUMBER_OF_PLAYS = 1000000
class GamblingGame(object):
pass
@davydany
davydany / .tmux.conf
Created July 9, 2015 16:50
My tmux.conf File
# indexing
set-option -g base-index 1
# synchronize panes with "Y"
bind-key y set-window-option synchronize-panes
# mouse & scroll configurations
set-option -g mode-mouse on # allows us to use the mouse for scrolling
set-option -g mouse-select-pane on # select a pane with mouse
set-option -g history-limit 100000 # really large scroll-back