Skip to content

Instantly share code, notes, and snippets.

@diffused
diffused / Product.cs
Created November 20, 2013 14:12
Example Entity Framework 6 context using connection string in app.config
public class Product
{
public int Id { get; set; }
public string Name { get; set; }
}
@diffused
diffused / Preferences.sublime-settings
Created October 11, 2013 19:40
Sublime Text user settings to disable atomic saves so gaurd can see filesystem changes
{
"atomic_save": false,
}
@diffused
diffused / turn_off_event_tracker.reg
Created September 27, 2013 10:44
Turn off windows server 2008 shutdown event tracker prompt
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows NT\Reliability]
"ShutdownReasonOn"=dword:00000000
@diffused
diffused / cygwin symlinks for virtualbox
Last active December 19, 2015 16:28
Create symlinks so Vagrant via cygwin places VirtualBox VMs in the normal windows user home. Run these from Administrator cmd
/* Flatten das boostrap */
.well, .navbar-inner, .popover, .btn, .tooltip, input, select, textarea, pre, .progress, .modal, .add-on, .alert, .table-bordered, .nav>.active>a, .dropdown-menu, .tooltip-inner, .badge, .label, .img-polaroid {
-moz-box-shadow: none !important;
-webkit-box-shadow: none !important;
box-shadow: none !important;
-webkit-border-radius: 0px !important;
-moz-border-radius: 0px !important;
border-radius: 0px !important;
border-collapse: collapse !important;
background-image: none !important;
@diffused
diffused / start_colors_env.sh
Created June 22, 2013 18:12
Xubuntu shell script that starts a development environment / setup for one of my projects. To run: source ~/start_colors_env.sh It loads up a a bunch of *interactive* xfce4-terminals, sets virtualenv in each one, terminal tabs named "scratch" and "pry", loads sublime text from "scratch", web apps are started in "public_site" and "color_finder". …
#!/bin/sh
xfce4-terminal \
-T scratch \
--working-directory=/opt/colors/ \
-e 'env PROMPT_COMMAND="unset PROMPT_COMMAND; source ./_env/bin/activate; s . &" bash' \
--tab -T pry \
--working-directory=/opt/colors/ \
-e 'env PROMPT_COMMAND="unset PROMPT_COMMAND; source ./_env/bin/activate; cd ./apps ; ./pry_with_models.sh" bash' \
--window -T public_site \
--working-directory=/opt/colors/ \
@diffused
diffused / gist:5517341
Created May 4, 2013 12:24
Python peewee orm. How to do a "where in (1,2,3)" style query. It was kind of tricky to find the syntax in the docs/google
products = Product.select().where(
Product.id << [161,162,163,164,165]).where(
~(Product.brand_name >> None)
)
@diffused
diffused / gist:5480993
Created April 29, 2013 11:12
regex for search/replace to find all classic asp.net id attributes in html.
(id="Content\w*")
@diffused
diffused / parallel_process_images.py
Last active December 16, 2015 16:29
Perform distributed image processing, such as resizing, using an IPython cluster
# Start a basic, 4 node, local, ipython cluster, using:
# ipcluster start -n 4
#
# then run:
# ipython parallel_process_images.py
#
# this example reads in ./test_images/*.jpg
# and outputs a bunch of .png files to ./resized_test_images/
@diffused
diffused / gist:5458784
Last active December 16, 2015 15:49
Postgresql array column types in python peewee orm
from peewee import *
db = PostgresqlDatabase(None)
# custom type for postgres Text[] array column
class TextArrayField(Field):
db_field = 'Text[]'
def db_value(self, value):
return value