This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import print_function | |
from itertools import ifilter | |
import re | |
def snake_case(string): | |
return re.sub('[A-Z]+', lambda m: '_' + m.group().lower(), string).lstrip('_') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sed -nrf | |
s_,,,,_,"","","",_g # first we substitute blank fields with quoted blanks for consistency | |
s_,,,_,"","",_g # first we substitute blank fields with quoted blanks for consistency | |
s_,,_,"",_g # first we substitute blank fields with quoted blanks for consistency | |
s_,$_,""_ # then we handle similar blank trailing fields | |
/^([^"]|",|"")/ { # if the line does not start with " (incomplete line) | |
x # first swap the previous line [see (*) below] into pattern space and this incomplete line into hold space | |
G # add the above held incomplete like to the pattern separated by \n |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
export PGPASSWORD='password' | |
IFS=':' | |
echo '' | |
date '+%F %T' | |
for HOST in www.{foo,bar}.com; do |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
from __future__ import print_function | |
import sys | |
import threading | |
import Queue | |
import argparse | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vault mount-tune -default-lease-ttl=1800s -max-lease-ttl=1800s auth/ldap |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -e | |
#set -o xtrace | |
sed -nre '/ssl_certificate\s/ { F; s,^.*/(.*);$,\1\n,; p}' /etc/nginx/sites-enabled/* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Usage: java [-options] class [args...] | |
(to execute a class) | |
or java [-options] -jar jarfile [args...] | |
(to execute a jar file) | |
where options include: | |
-d32 use a 32-bit data model if available | |
-d64 use a 64-bit data model if available | |
-server to select the "server" VM | |
The default VM is server. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
""" | |
Copyright (c) 2009-2010 Voxilate, Inc. | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights | |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
copies of the Software, and to permit persons to whom the Software is |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Vagrant.configure(2) do |config| | |
config.vm.box = "fedora/23-cloud-base" | |
config.vm.provider "virtualbox" do |vbox| | |
# Modify netmask of default NAT interface to avoid conflict with VPN | |
vbox.customize ["modifyvm", :id, "--natnet1", "192.168.20.0/24"] | |
end | |
config.vm.network "public_network", bridge: "wlan0" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
def slicing(lang_idx, lang_cnt, lines): | |
'''Using islice; short, but requires knowledge of total line count''' | |
from itertools import islice | |
return islice(lines, lang_idx, 12, lang_cnt) | |
def counting(lang_idx, lang_cnt, lines): | |
'''Using count in conjunction with dropwhile; on and on and on and on...''' |