Skip to content

Instantly share code, notes, and snippets.

View mahmoudimus's full-sized avatar
💭
@_@

Mahmoud Rusty Abdelkader mahmoudimus

💭
@_@
View GitHub Profile
@mahmoudimus
mahmoudimus / The Technical Interview Cheat Sheet.md
Last active August 26, 2015 15:58 — forked from tsiege/The Technical Interview Cheat Sheet.md
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.

Studying for a Tech Interview Sucks, so Here's a Cheat Sheet to Help

This list is meant to be a both a quick guide and reference for further research into these topics. It's basically a summary of that comp sci course you never took or forgot about, so there's no way it can cover everything in depth. It also will be available as a gist on Github for everyone to edit and add to.

Data Structure Basics

###Array ####Definition:

  • Stores data elements based on an sequential, most commonly 0 based, index.
  • Based on tuples from set theory.
# http://en.wikipedia.org/wiki/International_Bank_Account_Number#IBAN_formats_by_country
# http://www.swift.com/dsp/resources/documents/IBAN_Registry.pdf
al: # Albania
length: 28
regexp: >
(?<bank_identifier> \d{8})
(?<account_number> [A-Z0-9]{16})
ad: # Andorra
@mahmoudimus
mahmoudimus / pdm.py
Created February 7, 2014 01:40
post-mortem
try:
func()
except SystemExit:
raise
except:
logger.exception("Uncaught exception! Whooops! DEBUG MODE MOTHAFUCKA")
if sys.stdin.isatty() and not disable_pdb:
try:
from ipdb import post_mortem
except ImportError:
@mahmoudimus
mahmoudimus / README.md
Created March 21, 2014 18:57 — forked from fnichol/README.md
Kitchen.yml format changes.

Format Changes to Test Kitchen's kitchen.yml File

This is happening thanks to a refactoring of the data manipulation code formerly in Kitchen::Config.

There are now 3 main configuration blocks that can be placed in the various levels:

  • driver: Configurtation relavent to Kitchen drivers. This is a combination of what was driver_plugin and driver_config. Backwards compatability is guarenteed with the legacy formats for a time, then will be deprecated (with a warning when encountered), then will be removed in a future release.
  • provisioner: Configuration relating to the automation tool being used. Currently supporting "chef_solo" and "chef_zero". Previously several Chef-related config paths were dumped in a Suite block, namely data_path, data_bags_path, environments_path, nodes_path, roles_path, etc. These will be supported for backwards compatability, then will be deprecated (with a warning when encountered), then will be removed in a future release.
  • busser: Configuration rela
@mahmoudimus
mahmoudimus / sash.sh
Created April 21, 2014 18:09
~/.local/bin/sash.sh
# connect to machine
function sash {
if [ -z $1 ]; then
echo "Please enter machine name"
return 1
fi
local instance ip pem idx re ip_idx pem_idx username
idx=1
re='^[0-9]+$'
if [[ $2 =~ $re ]]; then
@mahmoudimus
mahmoudimus / vizor.py
Last active August 29, 2015 14:00
vizor-work
from cement.core import foundation, controller, handler
class VizorBaseController(controller.CementBaseController):
class Meta:
label = 'base'
description = 'Vizor is a cloud visualizer'
class VizorScanController(controller.CementBaseController):
class Meta:

Hello world python subcommand pattern

Using pyCLI vs commando to create some commands and subcommands.

https://gist.github.com/1202975.git

git clone git@gist.github.com:1202975.git python-hello-subcommand

How to write a well behaved console application? The ones with the best UIs allow configuration of core commands in a

if not sinatra.incoming ( ngx.req.get_method() , ngx.var.uri ) then
return ngx.exit ( 404 )
end
from blueprint import example
from extensions import mail
from flask import Flask
import settings
def create_app(settings=settings):
ret_val = Flask(__name__)
ret_val.config.from_object(settings)
# initialize extensions...
import (
"fmt";
"strings";
)
func main() {
s := []string{"this", "is", "a", "joined", "string\n"};
fmt.Printf(strings.Join(s, " "));
}