Skip to content

Instantly share code, notes, and snippets.

View Apreche's full-sized avatar
🚲

Scott Rubin Apreche

🚲
View GitHub Profile
@Apreche
Apreche / .psqlrc
Last active June 27, 2020 20:40
My psqlrc file
\set QUIET 1
\pset null 'Ø'
\x auto
\set COMP_KEYWORD_CASE upper
\unset QUIET
@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
@0XDE57
0XDE57 / config.md
Last active July 7, 2024 00:25
Firefox about:config privacy settings

ABOUT

about:config settings to harden the Firefox browser. Privacy and performance enhancements.
To change these settings type 'about:config' in the url bar. Then search the setting you would like to change and modify the value. Some settings may break certain websites from functioning and rendering normally. Some settings may also make firefox unstable. I am not liable for any damages/loss of data.

Not all these changes are necessary and will be dependent upon your usage and hardware. Do some research on settings if you don't understand what they do. These settings are best combined with your standard privacy extensions (HTTPS Everywhere No longer required: Enable HTTPS-Only Mode, NoScript/Request Policy, uBlock origin, agent spoofing, Privacy Badger etc), and all plugins set to "Ask To Activate".

@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.
@hrldcpr
hrldcpr / tree.md
Last active June 8, 2024 18:11
one-line tree in python

One-line Tree in Python

Using Python's built-in defaultdict we can easily define a tree data structure:

def tree(): return defaultdict(tree)

That's it!

@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'
@Apreche
Apreche / .bashrc
Last active June 28, 2020 22:37
Ubuntu 16.04 bashrc
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
umask 022
PATH="$HOME/bin:$HOME/.poetry/bin:$HOME/.local/bin:$PATH"
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;