Skip to content

Instantly share code, notes, and snippets.

View Apreche's full-sized avatar
🚲

Scott Rubin Apreche

🚲
View GitHub Profile
@Apreche
Apreche / githubnotes.py
Created September 4, 2012 15:52
github hosted shownotes
import urllib2
import base64
from django.utils import simplejson
def get_file_contents(user, repo, path):
url = "https://api.github.com/repos/%s/%s/contents/%s" % (user, repo, path)
try:
response = urllib2.urlopen(url)
except urllib2.HTTPError:
@Apreche
Apreche / secrypt.php
Created November 30, 2012 12:30
lucb1e's secrypt original code
<?php
/**************************************************************************
LICENCE
- You may copy and redistribute this file under the conditions:
1. The file is credited to lucb1e
2. The file remains unmodified, including this licence
- You may modify and redistribute this file under these conditions:
(This includes porting to another language.)
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\9bis.com\KiTTY\Sessions\Default%20Settings]
"Colour0"="77,77,76"
"Colour1"="234,234,234"
"Colour2"="250,250,250"
"Colour3"="0,0,0"
"Colour4"="214,214,214"
"Colour5"="214,214,214"
"Colour6"="142,144,140"
@Apreche
Apreche / gist:2954956
Created June 19, 2012 15:55
MySQL create user and database
create database DATABASENAME;
grant usage on *.* to USERNAME@localhost identified by 'PASSWORD';
grant all privileges on DATABASENAME.* to USERNAME@localhost ;
@Apreche
Apreche / create_db_user.sh
Last active April 7, 2020 15:51
Create a new PostgreSQL database and user for local development
#!/usr/bin/env bash
# Create a postgres database, user, and password for a local dev app
psql << EOF
CREATE DATABASE $1;
CREATE USER $1 WITH PASSWORD '$1';
ALTER ROLE $1 SET client_encoding to 'utf8';
ALTER ROLE $1 SET default_transaction_isolation TO 'read committed';
ALTER ROLE $1 SET timezone to 'UTC';
GRANT ALL PRIVILEGES on DATABASE $1 to $1;
@Apreche
Apreche / jupyter_notebook_config.py
Created April 1, 2020 02:29
Jupyter Notebook Config File
# Configuration file for jupyter-notebook.
#------------------------------------------------------------------------------
# Application(SingletonConfigurable) configuration
#------------------------------------------------------------------------------
## This is an application.
## The date format used by logging formatters for %(asctime)s
#c.Application.log_datefmt = '%Y-%m-%d %H:%M:%S'
@Apreche
Apreche / django_script.py
Created March 12, 2019 14:26
Stand Alone Django Script
#!/usr/bin/env python
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "projectname.settings")
import django # noqa
django.setup()
@Apreche
Apreche / pip.conf
Created January 20, 2017 16:36
Pip Configuration
[list]
format = columns
@Apreche
Apreche / ipython_config.py
Last active April 7, 2020 15:53
iPython configuration
# Configuration file for ipython.
#------------------------------------------------------------------------------
# InteractiveShellApp(Configurable) configuration
#------------------------------------------------------------------------------
## A Mixin for applications that start InteractiveShell instances.
#
# Provides configurables for loading extensions and executing files as part of
# configuring a Shell environment.
@Apreche
Apreche / bash_aliases
Last active April 7, 2020 15:53
bash_aliases
alias apt-search="apt-cache search --names-only"
alias greppy='find ! -path "*migrations*" -name "*.py" | xargs grep'
alias grephtml='find -name "*.html" | xargs grep'
alias grepjs='find -name "*.js" | xargs grep'
alias grepcss='find -name "*.css" | xargs grep'
alias grepall='find ! -path "*migrations*" -and ! -name "*.pyc" | xargs grep'
alias grepregex='grep -rnE'
alias rmpyc='find -name "*.pyc" -delete'
alias runserver='./manage.py runserver_plus 0.0.0.0:8000'
alias gittag='git tag | sort -g'