Skip to content

Instantly share code, notes, and snippets.

☎️
call me on my #!/bin/sh phone

Matthew Loberg mloberg

☎️
call me on my #!/bin/sh phone
Block or report user

Report or block mloberg

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View installer.go
package main
import (
"fmt"
"io/ioutil"
"os"
"os/exec"
"reflect"
"regexp"
"strings"
@BsWiM
BsWiM / PHP Constructor
Last active Feb 23, 2018
PHPStorm File and Code Templates
View PHP Constructor
/**
* Constructor
#if (${PARAM_DOC} != "") *
#else#end
${PARAM_DOC}
*/
public function __construct(${PARAM_LIST}) {${BODY}}
View sqlalchemy-query-stats.py
from sqlalchemy import engine
from sqlalchemy import event
class DbStats():
def __init__(self):
self.clear()
def clear(self):
self.total_queries = 0
self.total_time = 0
@simon-weber
simon-weber / externalcall.py
Last active Nov 24, 2018
Custom tooling to ease VCR.py management.
View externalcall.py
import vcrutils
VCR_CASSETTE_PATH = APPROOT + '/venmo_tests/cassettes/' # eg
MAKE_EXTERNAL_REQUESTS = os.environ.get('MAKE_EXTERNAL_REQUESTS') == 'TRUE'
@dual_decorator # convert a paramaterized decorator for no-arg use (https://gist.github.com/simon-weber/9956622).
def external_call(*args, **kwargs):
"""Enable vcrpy to store/mock http requests.
@hubert3
hubert3 / samsung_hash_crack.py
Last active Dec 15, 2016
Python implementation of passcode hashing algorithm used on the Samsung Galaxy S4 GT-I9505 4.2.2
View samsung_hash_crack.py
#!/usr/bin/python
'''
Python implementation of passcode hashing algorithm used on the Samsung Galaxy S4 GT-I9505 4.2.2
Correct PIN for hash and salt below is 1234.
Get 40-character hash value in ascii hex format from file /data/system/password.key on the phone
Get salt in signed numeric format by doing sqlite3 query SELECT value FROM locksettings WHERE name = 'lockscreen.password_salt' on /data/system/locksettings.db
@SeanJA
SeanJA / README.md
Last active Oct 21, 2016
Google Pageviews
View README.md

Set Up

You will need Sija's version of the garb gem, so add this line to your Gemfile (you will need git installed for this):

gem 'garb', :git => 'git://github.com/Sija/garb.git'

Then run the gem bundler: bundle install

Set your google username

@juanje
juanje / gist:3797297
Created Sep 28, 2012
Mount apt cache of a Vagrant box in the host to spin up the packages installation
View gist:3797297

This is a little trick I use to spin up the packages instalation on Debian/Ubuntu boxes in Vagrant.

I add a simple function that checks if a directory named something similar to ~/.vagrant.d/cache/apt/opscode-ubuntu-12.04/partial (it may have another path in Windows or MacOS) and create the directory if it doesn't already exist.

def local_cache(basebox_name)
  cache_dir = Vagrant::Environment.new.home_path.join('cache', 'apt', basebox_name)
  partial_dir = cache_dir.join('partial')
  partial_dir.mkdir unless partial_dir.exist?
  cache_dir
@datenimperator
datenimperator / Gemfile
Created Sep 7, 2012
Sinatra, sprockets, compass, bootstrap-sass playing together
View Gemfile
source :rubygems
gem 'shotgun', :group=>:development
gem 'rack-cache'
gem 'sinatra', :require => 'sinatra/base'
gem 'sinatra-support'
gem 'haml'
@bbeck
bbeck / setup.sh
Created Jun 27, 2012
Setup Asgard on Ubuntu 12.04
View setup.sh
#################
# Update packages
#################
DEBIAN_FRONTEND="noninteractive" sudo apt-get --assume-yes update
DEBIAN_FRONTEND="noninteractive" sudo apt-get --assume-yes upgrade
########################
# Install the Oracle JDK
########################
@guenter
guenter / move_to_rds.rb
Created Nov 11, 2010
A quick and dirty script to move a database into Amazon RDS (or any other database). Can transfer part of the data beforehand.
View move_to_rds.rb
require 'fileutils'
start_time = Time.now
SOURCE_DB = {
:name => 'db_name',
:user => 'db_user',
:password => 'db_pass',
:host => 'localhost'
You can’t perform that action at this time.