Skip to content

Instantly share code, notes, and snippets.

View mloberg's full-sized avatar
🐚
call me on my #!/bin/sh phone

Matt Loberg mloberg

🐚
call me on my #!/bin/sh phone
View GitHub Profile
@victorholt
victorholt / installer.go
Created March 7, 2018 18:44
Docker Installer
package main
import (
"fmt"
"io/ioutil"
"os"
"os/exec"
"reflect"
"regexp"
"strings"
@brockriemenschneider
brockriemenschneider / PHP Constructor
Last active February 23, 2018 17:19
PHPStorm File and Code Templates
/**
* Constructor
#if (${PARAM_DOC} != "") *
#else#end
${PARAM_DOC}
*/
public function __construct(${PARAM_LIST}) {${BODY}}
@protrolium
protrolium / ffmpeg.md
Last active April 8, 2024 11:49
ffmpeg guide

ffmpeg

Converting Audio into Different Formats / Sample Rates

Minimal example: transcode from MP3 to WMA:
ffmpeg -i input.mp3 output.wma

You can get the list of supported formats with:
ffmpeg -formats

You can get the list of installed codecs with:

@rozifus
rozifus / Python SimpleHTTPServer with SSL
Last active October 9, 2022 22:40
Python SimpleHTTPServer with SSL
# useful for running ssl server on localhost
# which in turn is useful for working with WebSocket Secure (wss)
# copied from http://www.piware.de/2011/01/creating-an-https-server-in-python/
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 November 24, 2018 21:52
Custom tooling to ease VCR.py management.
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 November 22, 2022 09:12
Python implementation of passcode hashing algorithm used on the Samsung Galaxy S4 GT-I9505 4.2.2
#!/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 October 21, 2016 07:40
Google Pageviews

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 September 28, 2012 00:38
Mount apt cache of a Vagrant box in the host to spin up the packages installation

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 September 7, 2012 18:55
Sinatra, sprockets, compass, bootstrap-sass playing together
source :rubygems
gem 'shotgun', :group=>:development
gem 'rack-cache'
gem 'sinatra', :require => 'sinatra/base'
gem 'sinatra-support'
gem 'haml'