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
def urlses(cl: ClassLoader): Array[java.net.URL] = cl match { | |
case null => Array() | |
case u: java.net.URLClassLoader => u.getURLs() ++ urlses(cl.getParent) | |
case _ => urlses(cl.getParent) | |
} | |
val urls = urlses(getClass.getClassLoader) | |
println(urls.filterNot(_.toString.contains("ivy")).mkString("\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
// ==UserScript== | |
// @name Splunk | |
// @namespace https://splunk:8000/en-US/account/ | |
// @include https://splunk:8000/en-US/account/* | |
// @version 1 | |
// @grant none | |
// ==/UserScript== | |
// perl -ne 'chomp; print join("", map { sprintf "\\%o", ord } split("", $_)) . "\n"' | |
// Run this, type your password, then ctrl+d |
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
use Term::ReadKey; | |
ReadMode 2; | |
print "# "; | |
chomp(my $phrase = <STDIN>); | |
print "\n" . join("", map { sprintf "\\%o", ord } split("", $phrase)) . "\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
# PUPPET CONFIG MANIFEST FOR IRF (Installs LAMP stack, tomcat8 and memcached) | |
# If you are running this locally on an agent, place this file in /etc/puppet/manifests and run puppet appy irf.pp --test | |
# execute 'apt-get update' | |
exec { 'apt-update': # exec resource named 'apt-update' | |
command => '/usr/bin/apt-get update' # command this resource will run | |
} | |
# install apache2 package | |
package { 'apache2': |
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
function trunclog { | |
# Truncate a log file and leave N lines of tail remaining. | |
if [ "$*" = "" ] | |
then | |
echo "Usage: trunclog [lines] [log-file]" | |
else | |
REQUESTED_LINES=$1 | |
LOG=$2 | |
TEMP=/tmp/`basename $LOG`.tmp.$$ | |
tail -$REQUESTED_LINES $LOG > $TEMP |
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
; IMPORTANT INFO ABOUT GETTING STARTED: Lines that start with a | |
; semicolon, such as this one, are comments. They are not executed. | |
; This script has a special filename and path because it is automatically | |
; launched when you run the program directly. Also, any text file whose | |
; name ends in .ahk is associated with the program, which means that it | |
; can be launched simply by double-clicking it. You can have as many .ahk | |
; files as you want, located in any folder. You can also run more than | |
; one ahk file simultaneously and each will get its own tray icon. |
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/perl -w | |
# Tiny script to color your output green for stdout, red for stderr | |
# Use it like this: color [app] [args ...] | |
use strict; | |
use warnings; | |
use Term::ANSIColor; | |
use IPC::Open3; | |
no warnings 'once'; |
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
user www-data; | |
worker_processes auto; | |
error_log /var/log/nginx/error.log warn; | |
pid /var/run/nginx.pid; | |
events { | |
worker_connections 1024; | |
multi_accept on; |
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
"=============================================================================== | |
"VIM Configuration File | |
"============================================================================== | |
set printoptions=paper:letter,syntax:n | |
syntax on | |
"turn on doxygen syntax hilighting. Works for C, C++, C#, and IDL files. | |
let g:load_doxygen_syntax=1 |
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
function count_rows { | |
# Count the rows in all the tables in a sqlite db | |
# Usage: count_rows my-sqlite.db | |
DB=$1 | |
TABLES=`echo "SELECT name FROM sqlite_master WHERE type='table';" | sqlite3 $DB` | |
for TABLE in $TABLES | |
do | |
printf "%10d %s\n" `echo "SELECT count(*) from $TABLE;" | sqlite3 $DB` $TABLE |
OlderNewer