Skip to content

Instantly share code, notes, and snippets.

View chdsbd's full-sized avatar

Christopher Dignam chdsbd

View GitHub Profile
INSERT INTO legacy_understandinginstitutionpg ("created", "modified", "visible", "matching", "institution_id", "understanding_id")
SELECT
now() "created",
now() "modified",
false visible,
false matching,
1107 institution_id,
id understanding_id
FROM
legacy_understandingpg
@chdsbd
chdsbd / find_conflicts.py
Last active December 26, 2018 23:00
find conflicting file names between two folders. For use with JS-style import systems. (I didn't want to just delete this, so it's here for posterity)
#!/usr/bin/env python3
"""
Find conflicting files between folders.
When using absolute imports, it is possible to have conflicts where a module
is shadowed by a dependency in node_modules. This will detect such an issue
and warn. We compare without file extensions, to behave as Node imports do.
"""
import argparse
from pathlib import Path
@chdsbd
chdsbd / slack-dnd.md
Created September 16, 2018 04:15
Disable Slack notifications for the weekend

Disable Slack notifications for the weekend

There isn't a way to configure DND for the weekend on Slack. However, you can use the /dnd 24 hours command to disable notifications for 24 hours using the [undocumented API][api] and [legacy tokens][token]. We're going to use the undocumented api and IFTTT to automate this.

Steps

  1. Generate a [token] for your account
  2. Navigate to your personal DM and copy the url (e.g. DAYM93S0N from acme.slack.com/messages/DAYM93S0N/convo/GBG661YR2-1536698414.000100/)
  3. Update the following url with your information (TOKEN looks like xoxp-4030334043-4959593942-3030320302032-sdf23rfasdf23rsf and CHANNEL looks like DAYM93S0N)
    https://slack.com/api/chat.command?token=xoxp-4030334043-4959593942-3030320302032-sdf23rfasdf23rsf&channel=DAYM93S0N&command=%2Fdnd&text=24%20hours
diff --git a/src/lib.rs b/src/lib.rs
index 1e3c965..d8b8176 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -120,6 +120,9 @@ mod tests {
assert_eq!(display(parse_date_string("friday 10:30",base,Dialect::Uk)),"2018-03-23T10:30:00+00:00");
assert_eq!(display(parse_date_string("friday 8pm",base,Dialect::Uk)),"2018-03-23T20:00:00+00:00");
+ // Hour of base day.
+ assert_eq!(display(parse_date_string("6:15pm",base,Dialect::Uk)),"2018-03-21T18:15:00+00:00");
dtrace: system integrity protection is on, some features will not be available
PID/THRD SYSCALL(args) = return
error: file 'nixpkgs' was not found in the Nix search path (add it using $NIX_PATH or -I), at (string):1:13
dtrace: error on enabled probe ID 2190 (ID 566: syscall::sysctl:return): invalid kernel access in action #11 at DIF offset 28
dtrace: error on enabled probe ID 2190 (ID 566: syscall::sysctl:return): invalid kernel access in action #11 at DIF offset 28
dtrace: error on enabled probe ID 2166 (ID 168: syscall::read:return): invalid kernel access in action #13 at DIF offset 68
dtrace: error on enabled probe ID 2190 (ID 566: syscall::sysctl:return): invalid kernel access in action #11 at DIF offset 28
dtrace: error on enabled probe ID 2190 (ID 566: syscall::sysctl:return): invalid kernel access in action #11 at DIF offset 28
dtrace: error on enabled probe ID 2190 (ID 566: syscall::sysctl:return): invalid kernel access in action #11 at DIF offset 28
dtrace: error on enabled probe ID 2166 (ID 168
dtrace: system integrity protection is on, some features will not be available
PID/THRD SYSCALL(args) = return
error: file 'nixpkgs' was not found in the Nix search path (add it using $NIX_PATH or -I), at (string):1:13
dtrace: error on enabled probe ID 2190 (ID 566: syscall::sysctl:return): invalid kernel access in action #11 at DIF offset 28
dtrace: error on enabled probe ID 2190 (ID 566: syscall::sysctl:return): invalid kernel access in action #11 at DIF offset 28
dtrace: error on enabled probe ID 2166 (ID 168: syscall::read:return): invalid kernel access in action #13 at DIF offset 68
dtrace: error on enabled probe ID 2190 (ID 566: syscall::sysctl:return): invalid kernel access in action #11 at DIF offset 28
dtrace: error on enabled probe ID 2190 (ID 566: syscall::sysctl:return): invalid kernel access in action #11 at DIF offset 28
dtrace: error on enabled probe ID 2190 (ID 566: syscall::sysctl:return): invalid kernel access in action #11 at DIF offset 28
dtrace: error on enabled probe ID 2166 (ID 168
@chdsbd
chdsbd / interfaces
Created September 4, 2016 01:51
Files for UMass Network
# /etc/wpa_supplicant/wpa_supplicant.conf
ap_scan=0
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="eduroam"
proto=RSN
key_mgmt=WPA-EAP
pairwise=CCMP
auth_alg=OPEN
#!/bin/bash
# Clouflare's old v1 api - https://www.cloudflare.com/docs/client-api.html
IP=`dig +short myip.opendns.com @resolver1.opendns.com`
curl -X PUT https://api.cloudflare.com/client/v4/zones/<ZONE-ID>/dns_records/<REC-ID> \
-H 'X-Auth-Email: <ACCOUNT-EMAIL>' \
-H 'X-Auth-Key: <API-TOKEN>' \
-H 'Content-Type: application/json' \
#include <Servo.h>
Servo myservo;
void setup()
{
myservo.attach(14);
myservo.write(90); // set servo to mid-point
}
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BOARD)
GPIO.setup(13, GPIO.OUT)
p = GPIO.PWM(13, 50)
p.start(7)
print "STARTED"
for i in range(0, 11):