Skip to content

Instantly share code, notes, and snippets.

View varikin's full-sized avatar
🏠
Working from home

John Shimek varikin

🏠
Working from home
View GitHub Profile
@varikin
varikin / BestJavaEver.java
Last active September 30, 2021 19:35
The Original Best Java Ever
import static java.lang.System.*;
import static java.lang.Integer.*;
import static java.lang.String.*;
import static java.lang.Float.compare;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.List;
import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;

Keybase proof

I hereby claim:

  • I am varikin on github.
  • I am varikin (https://keybase.io/varikin) on keybase.
  • I have a public key whose fingerprint is B7E0 272A E0CB D181 B817 D647 78FE 0D1F FBCA 450F

To claim this, I am signing this object:

@varikin
varikin / gist:2719936
Created May 17, 2012 16:16
Adium with 100%CPU and 5.5 GB of RAM
This file has been truncated, but you can view the full file.
Sampling process 621 for 3 seconds with 1 millisecond of run time between samples
Sampling completed, processing symbols...
Analysis of sampling Adium (pid 621) every 1 millisecond
Process: Adium [621]
Path: /Applications/Adium.app/Contents/MacOS/Adium
Load Address: 0x100000000
Identifier: com.adiumX.adiumX
Version: 1.5 (1.5)
Code Type: X86-64 (Native)
Parent Process: launchd [206]
@varikin
varikin / vhost
Created February 20, 2012 23:52
Example Apache virtual host file for mod_wsgi
<VirtualHost *:80>
ServerAdmin admin@example.com
ServerName example.com
LogLevel warn
ErrorLog /path/to/logs/project_error.log
CustomLog /path/to/logs/project_access.log combined
# Ensures Apache servers static files
# These should match STATIC_ROOT and STATIC_URL
@varikin
varikin / django.wsgi
Created February 20, 2012 23:45
Example WSGI file for mod_wsgi
import os, sys, site
# Adds the virtualenv library to the path
ENV_PATH = os.path.realpath(os.path.join(os.path.dirname(__file__), '..', '..', '..'))
site.addsitedir(os.path.join(ENV_PATH, 'lib','python2.6','site-packages'))
# Adds the project to the path
# Note that depending on the location of this file, PROJECT_PATH might change
PROJECT_PATH = os.path.realpath(os.path.join(os.path.dirname(__file__), '..', '..'))
sys.path.append(PROJECT_PATH)
@varikin
varikin / fabfile.py
Created February 20, 2012 23:41
A sort of hand crafted fabfile that servers my needs
from os.path import join
from fabric.api import env, require, run, cd
# Fabfile to deploy a Django app. To use run:
#
# fab staging deploy
#
# or
#
# fab prod deploy
My problems with Lion:
Full screen apps suck on multiple monitors because the second monitor is blank and I can't do anything about it. On the other hand, on my MBA, fullscreen apps rock.
My MBA has crashed (kernel panics) a couple times. Could be Lion, could be hardware.
Initially, had issues with wifi reconnecting after waking up. Seems to be fixed now.
I use to use the three finger swipe to go back both in the browser and in the Twitter app. Now this swipe changes desktops. I could reset that but it annoys me.
function net_match ( $network , $ip ) {
$ip_arr = explode ( '/' , $network );
$network_long = ip2long ( $ip_arr [ 0 ]);
$x = ip2long ( $ip_arr [ 1 ]);
$mask = long2ip ( $x ) == $ip_arr [ 1 ] ? $x : 0xffffffff << ( 32 - $ip_arr [ 1 ]);
$ip_long = ip2long ( $ip );
return ( $ip_long & $mask ) == ( $network_long & $mask );
}
function net()
import os
import shutil
import md5
def find_duplicate_files(dirs):
all_files = {}
for dir in dirs:
for dirname, dirs, filenames in os.walk(dir):
if '.svn' in dirs:
dirs.remove('.svn')
#!/usr/bin/env python
from datetime import datetime, timedelta
import httplib2
from lxml import etree
import sys
import time
from urllib import urlencode
API_KEY = "api_key_goes_here"