Skip to content

Instantly share code, notes, and snippets.

View cgreening's full-sized avatar

Chris cgreening

View GitHub Profile
@cgreening
cgreening / 2021_day15.ts
Created December 15, 2021 11:01
Advent of Code 2021 Day 15
import fs from "fs";
import Heap from "heap-js";
function parseData(filename: string) {
return fs
.readFileSync(filename, "utf8")
.split("\n")
.filter((line) => line.length > 0)
.map((line) => line.split("").map((c) => parseInt(c, 10)));
}
@cgreening
cgreening / day14.ts
Created December 14, 2021 09:46
Advent of Code 2021 - Day14 - Typescript
import fs from "fs";
function parseData(filename: string) {
const lines = fs
.readFileSync(filename, "utf8")
.split("\n")
.filter((line) => line.length > 0);
const template = lines.shift()!;
@cgreening
cgreening / quickaction.sh
Created July 1, 2021 14:41
Quick Action for Converting Image Files to PNG or JPEG
# See here for details - https://youtu.be/Sfr0OQuZbA4
# Make sure the image magick tools are in the path
export PATH=/usr/local/bin/:$PATH
# iterate through each file - make sure you selected: Pass Input "As Arguments"
for f in "$@"
do
# use mogrify to convert to JPEG - change to PNG for PNG conversion
mogrify -format jpeg "$f"
done
import { X_OK } from "constants";
import { isAccessor } from "typescript";
class CubeSpace {
activeCount = 0;
potentiallyActive: {
[key: number]: { x: number; y: number; z: number; w: number };
} = {};
memory = new Set<number>();
getKey(x: number, y: number, z: number, w: number) {
function day15_part2(numbers: number[]) {
const cache = new Array<{ lastSpoken: number; previousSpoken: number }>(
30000000
);
function computeNewNumber(spoken: number) {
const turnSpoken = cache[spoken];
// first time spoken
if (
!turnSpoken ||
@cgreening
cgreening / tracker_csv_export_to_pdf.rb
Created October 29, 2018 16:22 — forked from rheaton/tracker_csv_export_to_pdf.rb
takes a csv file from tracker and makes story cards. be careful of the order when you are cutting them up.
#!/usr/bin/env ruby
# Script to generate PDF cards suitable for planning poker
# from Pivotal Tracker [http://www.pivotaltracker.com/] CSV export.
# Inspired by Bryan Helmkamp's http://github.com/brynary/features2cards/
# Example output: http://img.skitch.com/20100522-d1kkhfu6yub7gpye97ikfuubi2.png
require 'rubygems'

Keybase proof

I hereby claim:

  • I am cgreening on github.
  • I am cgreening (https://keybase.io/cgreening) on keybase.
  • I have a public key ASAnNcQOiE7PnIxD4lC--Hns4IZetQSvsWxYvzoktWWSmAo

To claim this, I am signing this object:

<html>
<head>
</head>
<body>
<script src='https://code.jquery.com/jquery-2.1.3.min.js'></script>
<script src='https://www.nodule.io/js/nodule.151851370efa27253700.js'></script>
<script language='javascript'>
console.log('Using nodule version', nodule.version);
// connect to nodule
@cgreening
cgreening / notifiy.js
Last active August 29, 2015 14:22
notifiy
profile.services[SERVICE_UUID].characteristics[CHARACTERISTIC_UUID].on('read', function(value) {
console.log('New value', value);
});
profile.services[SERVICE_UUID].characteristics[CHARACTERISTIC_UUID].setNotifyState(true);
@cgreening
cgreening / read.js
Last active August 29, 2015 14:22
read
profile.services[SERVICE_UUID].characteristics[CHARACTERISTIC_UUID].on('read', function(value) {
console.log('New value', value);
});
profile.services[SERVICE_UUID].characteristics[CHARACTERISTIC_UUID].read();