Skip to content

Instantly share code, notes, and snippets.

View adamatan's full-sized avatar

Adam Matan adamatan

View GitHub Profile
WARNING 2012-12-01 11:23:04,126 rdbms_mysqldb.py:74] The rdbms API is not available because the MySQLdb library could not be loaded.
INFO 2012-12-01 11:23:04,196 appcfg.py:585] Checking for updates to the SDK.
INFO 2012-12-01 11:23:05,058 appcfg.py:619] This SDK release is newer than the advertised release.
INFO 2012-12-01 11:23:05,092 dev_appserver_multiprocess.py:655] Running application dev~mifmif-il on port 8080: http://localhost:8080
INFO 2012-12-01 11:23:05,092 dev_appserver_multiprocess.py:657] Admin console is available at: http://localhost:8080/_ah/admin
WARNING 2012-12-01 11:23:05,572 py_zipimport.py:139] Can't open zipfile /Library/Python/2.7/site-packages/BeautifulSoup-3.2.1-py2.7.egg: IOError: [Errno 13] file not accessible: '/Library/Python/2.7/site-packages/BeautifulSoup-3.2.1-py2.7.egg'
WARNING 2012-12-01 11:23:05,572 py_zipimport.py:139] Can't open zipfile /Library/Python/2.7/site-packages/pyexif-0.2.1-py2.7.egg: IOError: [Errno 13] file not accessible: '/Library/Python/2.7
@adamatan
adamatan / colors.py
Created December 18, 2012 10:41
Quick Python colors
# http://stackoverflow.com/questions/287871/print-in-terminal-with-colors-using-python/287944#287944
class bcolors:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
@adamatan
adamatan / extract_thread_dump.awk
Created January 23, 2013 12:14
AWK: Extract text between two delimiters. Write each match to file/
# First thread dump line
/^Full thread dump Java/ {
thread_dump=1;
counter++;
lines=0;
filename="Thread_dump_"counter".txt";
printf "Found thread dump #%-4d\t", counter
}
# Last thread dump text block
@adamatan
adamatan / cheat.bash
Created February 5, 2013 10:34
sed cheat sheet
# Remove empty lines
sed '/^$/d'
# Remove lines that begins with '#'
sed 's/^#.*//g'
@adamatan
adamatan / java_debugging_lab.md
Last active December 13, 2015 22:38
Lab: Java Production Debugging 101 (summary)

Lab: Java Production Debugging 101 (summary)

This lab will focus on common Java server production issues (including deadlocks, memory leaks and thread starvation), and introduce some of these tools by demonstrating how they can be used to analyze and resolve each scenario.

Forensics process

  • Gather evidence
  • Restore production
  • Analyze findings
  • Implement solution
  • Post Mortem
@adamatan
adamatan / linked_list.dot
Created March 19, 2013 12:21
Linked list in graphviz
digraph foo {
rankdir=LR;
node [shape=record];
a [label="{ <data> 12 | <ref> }", width=1.2]
b [label="{ <data> 99 | <ref> }"];
c [label="{ <data> 37 | <ref> }"];
d [shape=box];
a:ref:c -> b:data [arrowhead=vee, arrowtail=dot, dir=both, tailclip=false, arrowsize=1.2];
b:ref:c -> c:data [arrowhead=vee, arrowtail=dot, dir=both, tailclip=false];
c:ref:c -> d [arrowhead=vee, arrowtail=dot, dir=both, tailclip=false];
@adamatan
adamatan / WebView.java
Created April 27, 2013 11:51
Android Code snippets
// Adding a WebView to an existing layout
LinearLayout moviesLayout = (LinearLayout) findViewById(R.id.moviesLayout);
WebView wv = new WebView(this);
String html = "<html><body>You scored <b>192</b> points.</body></html>";
wv.loadData(html, "text/html", "UTF8");
moviesLayout.addView(wv);
@adamatan
adamatan / he_IL.js
Created November 22, 2013 15:45
Hebrew locale file for strftime
var strftime = require('strftime')
var sprintf = require('sprintf')
var he_IL = {
days: [ 'ראשון', 'שני', 'שלישי', 'רביעי', 'חמישי', 'שישי', 'שבת' ],
shortDays: [ 'א', 'ב', 'ג', 'ד', 'ה', 'ו', 'ש' ],
months: [ 'ינואר', 'פברואר', 'מרץ', 'אפריל', 'מאי', 'יוני', 'יולי', 'אוגוסט', 'ספטמבר', 'אוקטובר', 'נובמבר', 'דצמבר' ],
shortMonths: [ 'ינו', 'פבר', 'מרץ', 'אפר', 'מאי', 'יונ', 'יול', 'אוג', 'ספט', 'אוק', 'נוב', 'דצמ' ],
@adamatan
adamatan / desktop_configuration.sh
Last active January 3, 2016 00:19
My default apt-gets on every new Ubuntu install.
# Google Web Fonts
wget -O /tmp/fonts.zip "http://goo.gl/ON8WFL" && mkdir -p ~/.fonts && mv /tmp/fonts.zip ~/.fonts/ && cd ~/.fonts && unzip fonts.zip
# Microsoft fonts
sudo apt-get install ttf-mscorefonts-installer
# There's a newline below - believe me.