Skip to content

Instantly share code, notes, and snippets.

@SaraDGore
SaraDGore / djangocon_talk_suggestions.md
Last active May 25, 2018 20:15
Talks I want to see at DjangoCon US

Ideas for DjangoCon US talks

  • How to be an ally

  • An accessibility talk that goes beyond visual or mobility impairment

  • How to bridge from introductory materials to the skills needed as a junior developer

  • Recruiting, hiring, and interviewing skills

@judy2k
judy2k / parse_dotenv.bash
Created March 22, 2017 13:34
Parse a .env (dotenv) file directly using BASH
# Pass the env-vars to MYCOMMAND
eval $(egrep -v '^#' .env | xargs) MYCOMMAND
# … or ...
# Export the vars in .env into your shell:
export $(egrep -v '^#' .env | xargs)
@kyle-eshares
kyle-eshares / models.py
Created October 15, 2016 18:01
Strict ForeignKeys
from __future__ import unicode_literals
from django.db import models
from django.db.models.fields.related_descriptors import ForwardManyToOneDescriptor # noqa
class RelationNotLoaded(Exception):
pass
@bmhatfield
bmhatfield / .profile
Last active March 18, 2024 07:43
Automatic Git commit signing with GPG on OSX
# In order for gpg to find gpg-agent, gpg-agent must be running, and there must be an env
# variable pointing GPG to the gpg-agent socket. This little script, which must be sourced
# in your shell's init script (ie, .bash_profile, .zshrc, whatever), will either start
# gpg-agent or set up the GPG_AGENT_INFO variable if it's already running.
# Add the following to your shell init to set up gpg-agent automatically for every shell
if [ -f ~/.gnupg/.gpg-agent-info ] && [ -n "$(pgrep gpg-agent)" ]; then
source ~/.gnupg/.gpg-agent-info
export GPG_AGENT_INFO
else
@jnoller
jnoller / Comms.md
Last active March 18, 2016 19:49
Adapted Gitlab communications section

Internal Communication DRAFT

  • Use asynchronous communication when possible (issues and email instead of chat), issues are preferred over email, email is preferred over chat, announcements happen via email or team standup, and people should be able to do their work without getting interrupted by chat.
    • More importantly, a verbal or chat record does not spread communication widely and can vary based the person delivering the message (bias) or other tribal interpretation. A written record is always critical when it comes to questions, strategy and decisions. When decisions or information is ad-hoc is reinforces the idea that people are treated unequally, do not have a voice and are kept in the dark.
  • It is very OK to ask as many questions as you have, but ask them so many people can answer them and many people see the answer (so use issues or public chat channels instead of private messages or one-on-one emails) and make sure you try to document the answers.
  • If applicable, use github to track
@daneden
daneden / Instructions.md
Created December 1, 2015 00:25
Remap Caps Lock to Emoji on Mac

How to remap the caps lock key to the emoji selector on Mac

  1. Go to System Preferences -> Keyboard -> Modifier Keys...
  2. Change “Caps Lock” to “No action”
  3. Install Seil
  4. Change the Caps Lock key in Seil to keyCode 80 (F19)
  5. Install Karabiner
  6. Open Karabiner and go to Misc & Uninstall -> Open private.xml
  7. Copy the contents of this gist's example to the XML file and save
  8. In Karabiner, go to Change Keys -> Reload XML
@geoom
geoom / arduino_bluetooth_connection.ino
Last active October 31, 2022 15:38
Arduino bluetooth connection by python script on Mac OS X (yosemite)
// first make "pairing" with HC-06 devise
// view devises list by running 'ls /dev/tty.* in terminal, you can see /dev/tty.HC-06-DevB on the list
// then go to arduino editor, and choose your devise bluetooth under the 'Tools > Serial port' menu
// Now open the serial monitor (Tools > Serial monitor).
// You should notice that the red led of the bluetooth module has stopped blinking. That means we are connected!
// Now when you send a “1” the led on the pin 13 should turn ON, and if you send a “0” it should turn off.
void setup() {
// initialize serial:
@brosner
brosner / setup.md
Last active April 26, 2020 11:32
My development environment setup

Prepare by switching out of bash from Homebrew:

chsh -s /bin/zsh

To clean my system and reinstall Homebrew:

rm -rf ~/.local && mkdir ~/.local
rm -rf ~/Library/Caches/pip
rm -rf ~/.pyenv

rm -rf ~/.yarn

@idan
idan / gist:c27b2dd45a78273af848
Created October 8, 2014 13:13
Exploding Postgres HSTORE columns in Pandas
def explode_hstore(df, column):
"""Explode a column of a dataframe containing PostgreSQL hstore k-v pairs in the format of:
"foo"=>"bar", "baz"=>"quux", ...
Every key becomes a column. If a given row's pairs doesn't have a key, then the resulting column's value
will contain NaN.
"""
# split the tags column out as a new series, and break up each k=>v pair
s = df[column].str.split(', ').apply(pd.Series, 1).stack()