Skip to content

Instantly share code, notes, and snippets.

View jdangerx's full-sized avatar
🐢
writing slow code slowly

Dazhong Xia jdangerx

🐢
writing slow code slowly
  • Catalyst Cooperative
  • Cambridge, MA
View GitHub Profile
@jdangerx
jdangerx / diff.diff
Last active August 18, 2023 18:53
total axes playground
diff --git a/src/ferc_xbrl_extractor/datapackage.py b/src/ferc_xbrl_extractor/datapackage.py
index a1deb76..3bf2673 100644
--- a/src/ferc_xbrl_extractor/datapackage.py
+++ b/src/ferc_xbrl_extractor/datapackage.py
@@ -351,34 +351,29 @@ class FactTable:
Args:
instance: Parsed XBRL instance used to construct dataframe.
"""
- # Loop through contexts and get facts in each context
- # Each context corresponds to one unique row
@jdangerx
jdangerx / dev.py
Created August 17, 2023 16:40
migration comparison
"""fake juice awareness
Revision ID: d1da0341420e
Revises: 28bb2b27e2cf
Create Date: 2023-08-17 12:39:35.950853
"""
from alembic import op
import sqlalchemy as sa
@jdangerx
jdangerx / allocation-unit-test.diff
Created January 31, 2023 20:51
example unit test for missing energy source codes in PUDL allocation
diff --git a/test/unit/analysis/allocate_net_gen_test.py b/test/unit/analysis/allocate_net_gen_test.py
index e3a72a37..d0e50335 100644
--- a/test/unit/analysis/allocate_net_gen_test.py
+++ b/test/unit/analysis/allocate_net_gen_test.py
@@ -1,5 +1,6 @@
"""Unit tests for allocation of net generation."""
+from io import StringIO
from typing import Literal
@jdangerx
jdangerx / prompt.md
Last active September 27, 2021 21:50
code-review-prompt.md

Code Review Exercise

We review code here, so we like to see our candidates do it too. Here's an exercise in code review, which we expect to take about 2 hours.

We spun up a small application that lets utilities sign up to control devices. A utility administrator fills out a form; then we track the utility name, the type of devices they can control, and the type of control they can exert.

This is very exciting! But to actually control these devices we need to actually have them in our system. So an enterprising junior developer, Alex, has written some code for us to track devices with.

They worked on this for a few weeks, then submitted the PR about a week ago with this description:

Keybase proof

I hereby claim:

  • I am jdangerx on github.
  • I am haagen_daz (https://keybase.io/haagen_daz) on keybase.
  • I have a public key ASBGBXtCZmfFx5emDrRhO8lOwotq0HQcPQ2mxuHrnpx75Qo

To claim this, I am signing this object:

@jdangerx
jdangerx / gist:fb1b512daf602ef61b4c493aceafe3b1
Created August 25, 2016 22:12
exometer_core build failure
+john@computer:~/elixometer_test$ mix deps.compile
==> meck (compile)
==> edown (compile)
==> setup (compile)
==> setup (escriptize)
==> parse_trans (compile)
===> Compiling pobox
===> Compiling goldrush
===> Compiling lager
==> src (compile)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jdangerx
jdangerx / notes.md
Created January 14, 2016 20:25
Doorbot Debug 1/14/2016
  • node.js was segfaulting; we tried installing a bunch of different versions, blasted the original out of /usr/local/bin, eventually reinstalled original package (node version 0.12.6), and the segfault was gone...

  • originally thought that kill()`` in index.js` wasn't properly killing the process

  • used iptables firewall rules to block and unblock doorbot.recurse.com, while using tcpdump and strace to monitor the heartbeat calls

  • when we block the heartbeat calls, doorbot does exit and forever does start it back up again.

  • next time it disconnects and the process is still running, we should check tcpdump and strace to see if it's still sending out heartbeats.

@jdangerx
jdangerx / gist:7568815
Created November 20, 2013 18:53
scav parser. no item parsing yet
def split_into_sections(fh):
with open(fh, 'r') as f:
scavlist = f.read().split("\n")
scavlympics = get_section(scavlist, "Scav Olympics")
items = get_section(scavlist, "Items")
return scavlympics, items
def get_section(lst, section):
begin = lst.index("\\section*{{{}}}".format(section))
end = lst[begin:].index("\\end{list}")
@jdangerx
jdangerx / Ghost_Council_1.md
Last active December 25, 2015 11:39
Ghost Council of Max Palevsky, Sat Oct 12 2013

Team Structure

  • Over-organization and under-organization both lead to more stress
  • Roles should be relatively clearly defined
    • pictures of people in leadership roles should be available
    • armbands of authority?
  • with regards to recruitment: we should get to know first-years pre-hunt
    • This lets us filter for good page captains and special forces people etc

Roles we need filled