Skip to content

Instantly share code, notes, and snippets.

View cbigler's full-sized avatar

Canute Bigler cbigler

  • United States
View GitHub Profile

Keybase proof

I hereby claim:

  • I am cbigler on github.
  • I am biglerc (https://keybase.io/biglerc) on keybase.
  • I have a public key ASDN6C249d2xyqPIuQrX6DFYj_QKw9WBXDC5N1Q5hlcp9Ao

To claim this, I am signing this object:

@cbigler
cbigler / diff_dict.py
Created October 3, 2018 19:41
Diff nested dicts
def diff_dicts(d1, d2, path=None):
path = path or "root"
for k in d1.keys():
if k not in d2:
print(f'{path}: {k} as key not in d2')
else:
if type(d1[k]) is dict:
next_path = k if not path else f'{path}->{k}'
diff_dicts(d1[k], d2[k], next_path)
else:
@cbigler
cbigler / gist:d30a5710533e7b2cc82c31d4c47eb027
Created February 23, 2018 20:06
Use browser console to query React element
console.table($r.props.history.map(item => {if (item.node_type === 3) {return item.details}}))
@cbigler
cbigler / gist:74cda57847f63cd235484912b5737cb8
Created December 8, 2017 17:28
Docker: exec in last running container
sudo docker exec -it $(sudo docker ps -lq) python manage.py shell_plus
data = {
’communities': {
membership.community.id: {
'anonPrivateIp': membership.community.anonymize_private_ip,
'anonIndustry': membership.community.anonymize_industry,
'anonGeolocation': membership.community.anonymize_geolocation,
'anonName': membership.community.anonymize_name,
'shareSightings': membership.community.share_sightings,
},
} for membership in team.community_memberships if team else {},
@cbigler
cbigler / gist:37da4e94596b356d5da99e598e8b1f12
Created May 18, 2017 15:50
Resetting the auto increment field in Postgres
SELECT max(id) FROM table_name;
SELECT nextval('table_name_id_seq');
SELECT setval('table_name_id_seq', (SELECT MAX(id) FROM table_name));
@cbigler
cbigler / mui_colors.py
Created April 28, 2017 18:32
MaterialUI named colors in a Python class
class MuiColors(object):
red50 = '#ffebee'
red100 = '#ffcdd2'
red200 = '#ef9a9a'
red300 = '#e57373'
red400 = '#ef5350'
red500 = '#f44336'
red600 = '#e53935'
red700 = '#d32f2f'
red800 = '#c62828'
sudo find . -xdev -type f | cut -d "/" -f 2 | sort | uniq -c | sort -n