Skip to content

Instantly share code, notes, and snippets.

View ArcTanSusan's full-sized avatar
🎯
Focusing

Susan Tan ArcTanSusan

🎯
Focusing
  • United States
  • 08:00 (UTC -05:00)
View GitHub Profile
@ArcTanSusan
ArcTanSusan / gist:63e62cbd267119b61260
Last active August 29, 2015 14:20
Python dictionary question

Python question: Which is better?

self.worker.depends.get_networks().get('private').get('primary').get('bootnode_ip')

OR

self.worker.depends.get_networks()['private']['primary']['bootnode_ip']

A co-worker says neither, because no useful error messages result if the key is missing.

@ArcTanSusan
ArcTanSusan / gist:f421c74697925897c47b
Last active August 29, 2015 14:19
pycon 2015 conference talks with a social justice theme

Social justice talks from PyCon 2015

  • Note: Conference had child care, gluten-free, vegetarian food options, and a large scholarship fund for sponsoring minorities in tech to attend PyCon.

  • 1 more kool aspect of PyCon that was new in 2015: Live captioning (by human hands) for all the talks.

  • Kate Heddleton's talk on how your workplace is killing diversity: https://www.youtube.com/watch?v=kNke_4WOWAU

    • Critical feedback is hard to give. Everyone hates feedback! And often gender biased; women get disproportionately more negative feedback than men.
    • Other better ways to give feedback. Instead of using "NO" and "DONT", tell them what they should do.
    • Argument culture in workplace is very bad, as arguments are un-regulated. A workplace that rewards aggression is very bad.
  • Onboarding debt is bad for team culture. Systematic onboarding is super critical so that everyone gets a fair chance at doing well at job.

GET v1/hosts
{
"hosts": [
{
blah blah blah blah
blah blah blah blah
"uuid": "00000172-0017-0001-0010-000000000000",
"version": "4.3.42",
"frameworks": ["openstack", "spark"]
},
@ArcTanSusan
ArcTanSusan / accounts.tests.py
Last active August 29, 2015 14:05
OH/account/tests --> test_logout_web
# I use both django web-test AND django's client session to test that a user can be logged in and then logged out.
class Login(WebTest):
# {{{
fixtures = ['user-paulproteus', 'person-paulproteus']
def test_login(self):
user = authenticate(username='paulproteus', password="paulproteus's unbreakable password")
self.assert_(user and user.is_active)
def test_logout_web(self):
@ArcTanSusan
ArcTanSusan / reply_to_recruiter_spam
Last active August 29, 2015 14:04
How I reply to recruiter spam and so should you!
I was so inspired by https://medium.com/queer-life/do-something-useful-with-those-recruiting-emails-f62d82e13c2d,
so here's my template that you can feel free to use, copy and/or edit --
Hello $RECRUITER_NAME of $COMPANY_NAME,
Thanks so much for reaching out. Quick questions before we set anything up:
1. Are the company's health plans fully trans-inclusive? Are transition surgeries and medical expenses related to transgender transitions 100% covered by the employer’s medical plans?
Unless an employer explicitly negotiates otherwise, health insurance companies will refuse to cover any medical treatment related to being transgender. This includes labs, hormone replacement, therapy and psychiatry, surgery, and more. Many plans include language that specifically excludes these treatments from coverage; those that don’t will often exclude them on the grounds that they’re “cosmetic.”
@ArcTanSusan
ArcTanSusan / gist:f36cc0872d16116efdaf
Last active August 29, 2015 14:03
mysql master vs. mysql my_django_upgrade git diff comparison
5	5	  ERROR: test_submit_form (mysite.base.tests.Unsubscribe)
6	6	  ERROR: test (mysite.profile.tests.EditBio)
7	7	  ERROR: test (mysite.profile.tests.EditContactBlurb)
8	8	  ERROR: test_blurb_with_irc_info (mysite.profile.tests.EditContactBlurb)
9	9	  ERROR: test (mysite.profile.tests.EditHomepage)
10	10	  ERROR: test (mysite.profile.tests.EditIrcNick)
11	11	  ERROR: test (mysite.profile.tests.EditLocation)
12	12	  ERROR: test_settings_page_form (mysite.profile.tests.EditYourName)
13	13	  ERROR: test_tag_edit_once (mysite.profile.tests.Info)
{
"metadata": {
"name": "",
"signature": "sha256:025883229740ec0da175d59088cac88b2347cda445f6eb3bb7b65c99a2e43892"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
@ArcTanSusan
ArcTanSusan / gist:8530182
Created January 20, 2014 22:07
A simple Brython widget: button and pagination. I am debugging the show_additional_comment event handler. I get the error "Uncaught Error: local variable 'count' referenced before assignment". Feel free to leave comments.
<html>
<head>
<script src="Brython1.4/src/brython.js"></script>
<link rel="stylesheet" type="text/css" href='css/pagination.css'>
</head>
<body onload="brython(2)">
<div class ="preloaded_comment" id="comment1">some sample comment #1 here</div>
<div class ="preloaded_comment" id="comment2">some sample comment #2 here</div>
<div class ="preloaded_comment" id="comment3">some sample comment #3 here</div>
@ArcTanSusan
ArcTanSusan / Git_Automation_with_IPython_notebook
Last active January 3, 2016 04:49
Automate your git workflow with the IPython notebook
# Problem Statement:
# You have mulitple copies (or clones) of upstream repositories in your local drive.
# Your local cloned repos need to be updated against the upstream master repos on a regular basis.
# Here's one solution that uses the IPython notebook.
# Open up your IPython notebook browser in your working directory and then paste the following into a code cell.
# Press SHIFT+ENTER to run the code cell.
# Create a list of projects located in the working directory.
list_of_projects = ["django", "ipython", "oh-mainline"]
@ArcTanSusan
ArcTanSusan / gist:6559344
Last active December 23, 2015 01:19
Get all the Friday the 13ths in the future. 1-line Python code.
# Cited Source: Raymond Hettinger's tweet on 9/13/2013 at 11:00PM.
from datetime import timedelta, date
friday_the_13ths = filter(lambda d: d.day==13, (date(2013, 9, 13)+timedelta(days=7)*i for i in range(1000)))
>>> friday_the_13ths
[datetime.date(2013, 9, 13), datetime.date(2013, 12, 13), datetime.date(2014, 6, 13),
datetime.date(2015, 2, 13), datetime.date(2015, 3, 13), datetime.date(2015, 11, 13),
datetime.date(2016, 5, 13), datetime.date(2017, 1, 13), datetime.date(2017, 10, 13),
datetime.date(2018, 4, 13), datetime.date(2018, 7, 13), datetime.date(2019, 9, 13),