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 / townhall.md
Last active August 29, 2015 14:21
some thoughts about scav townhall

Overarching points

  • we need captains by the end of this year, and house reps would be great also. I think we're all agreed on this.
  • continuing workshops / build nights next year is very important to me personally and I think would do wonders for recruitment, sense of community, and skill training. To make sure this happens, we need a point person, since I won't be around physically. Whoever does this will have my full remote support.
  • in my opinion, team organization doesn't make a huge difference in
@jdangerx
jdangerx / geometry.xml
Created December 2, 2014 17:20
Fortran runtime error in OpenMC tallies
<?xml version="1.0"?>
<geometry>
<cell id="1" fill="5" surfaces="1 -2 3 -4" />
<cell id="101" universe="1" material="1" surfaces="-5" />
<cell id="102" universe="1" material="void" surfaces="5 -6" />
<cell id="103" universe="1" material="3" surfaces="6 -7" />
<cell id="104" universe="1" material="2" surfaces="7" />
<cell id="201" universe="2" material="2" surfaces="8" />
<cell id="302" universe="3" material="3" surfaces="9" />
<lattice id="5">