Skip to content

Instantly share code, notes, and snippets.

@mjdorma
mjdorma / wrap_shutil.py
Created August 3, 2013 07:08
Using begins to expose shutil
import shutil
import begin
begin.subcommand(shutil.copy)
begin.subcommand(shutil.copy2)
begin.subcommand(shutil.copyfile)
begin.subcommand(shutil.copymode)
begin.subcommand(shutil.copystat)
begin.subcommand(shutil.copytree)
begin.subcommand(shutil.move)
@muffinresearch
muffinresearch / gist:7676683
Last active August 18, 2016 22:52
Building simg2img
git clone https://android.googlesource.com/platform/system/extras
cd extras/ext4_utils
git checkout android-4.1.1_r1
gcc -o simg2img -lz sparse_crc32.c simg2img.c
ln -s ${PWD}/simg2img ~/bin/simg2img
# Last step make sure ~/bin is in your $PATH.
@jduck
jduck / adis.py
Last active February 2, 2017 15:28
Sample utility to disassemble a raw ARM bytecode file using Capstone.
#!/usr/bin/env python
#
# Simple utility to disassemble a raw bytecode file using Capstone.
#
# -jduck
#
import argparse
import capstone
import struct
@aliles
aliles / rawhelp.py
Created February 16, 2014 10:40
Example usage of the new begin.formatters module to preserve whitespace from docstrings in help output.
import begin
my_formatter = begin.formatters.compose(begin.formatters.RawDescription)
@begin.subcommand
def sub():
"""Such text
Very whitespace
So exact
"""
@aliles
aliles / flask_quickstart.py
Created February 18, 2014 11:39
Example CLI help output for possible re-implementation of boolean flags for begins.
from flask import Flask
import begin
app = Flask(__name__)
@app.route('/')
def hello_world():
return 'Hello World!'
@begin.start(env_prefix='WEB_')
"""pyvbox: setup appliance description and import_machines.
"""
import virtualbox
vbox = virtualbox.VirtualBox()
# Create new IAppliance and read the exported machine
# called 'ubuntu'.
appliance = vbox.create_appliance()
appliance.read("~/Documents/ubuntu.ova")
#!/usr/bin/env python
"""Example of choices with begins.
Python code:
main()
main('bar')
main(arg='baz')
Command line equivalent:
test.py