Skip to content

Instantly share code, notes, and snippets.

View ngmaloney's full-sized avatar

Nick Maloney ngmaloney

View GitHub Profile
@ngmaloney
ngmaloney / map_extract.rb
Last active February 10, 2022 13:42
Naive solution for finding a map page on a PDF by word frequency
require 'rmagick'
require 'rtesseract'
## Utility for extracting the map page from a survey_map pdf
class Utils::MapExtract
attr_reader :pdf_file, :images
def initialize(pdf_file)
@pdf_file = pdf_file
@images = []
@ngmaloney
ngmaloney / main.go
Created January 4, 2021 14:58
Example go service that uses bearer tokens instead of JWT tokens.
package main
import (
"crypto/rand"
"encoding/hex"
"encoding/json"
"log"
"net/http"
"strings"
@ngmaloney
ngmaloney / typescript.cr
Last active January 8, 2020 04:15
typescript.cr
require "duktape"
class Typescript
TYPESCRIPT_PATH = "deps/libs/ts/typescriptServices.js"
def initialize(ts_file : String)
@ts_file = ts_file
@ctx = Duktape::Sandbox.new
@ctx.eval!("ts = require('typescript')")
end
### Keybase proof
I hereby claim:
* I am ngmaloney on github.
* I am gnarco (https://keybase.io/gnarco) on keybase.
* I have a public key ASBtQYsM8i3EpzkdqEjWdKu4kL8zhVupFx4R4IPTTckSkgo
To claim this, I am signing this object:
@ngmaloney
ngmaloney / keybase.md
Created February 11, 2017 20:16
keybase.md

Keybase proof

I hereby claim:

  • I am ngmaloney on github.
  • I am ngmaloney (https://keybase.io/ngmaloney) on keybase.
  • I have a public key ASBt8LCxG1N-GKuX1VCrA3g3U-H1bq4vDOwTX02kjT0bLQo

To claim this, I am signing this object:

@ngmaloney
ngmaloney / _config.yml
Created October 16, 2015 01:06
Sample Jekyll Config
---
title: Jekyll Test
url: http://localhost:4000
timezone: UTC
permalink: pretty
defaults:
scope:
path: ""
values:
layout: "default"

Keybase proof

I hereby claim:

  • I am ngmaloney on github.
  • I am ngmaloney (https://keybase.io/ngmaloney) on keybase.
  • I have a public key whose fingerprint is 92FC FDF1 A39A F2FE BBFB 77D4 3C4F D1B0 0B0F AC71

To claim this, I am signing this object:

@ngmaloney
ngmaloney / gist:9689054
Created March 21, 2014 15:41
Procfile.dev
db: mysqld
redis: redis-server /usr/local/etc/redis.conf
web: bundle exec rails server -p 3001
@ngmaloney
ngmaloney / speedtest.sh
Created January 3, 2013 06:04
Quick and dirty cli speed tester.
#!/bin/bash
LOG=~/Desktop/speedtest.log
FILE=http://speedtest.wdc01.softlayer.com/downloads/test10.zip
echo "scale=2; `curl --progress-bar -w "%{speed_download}" $FILE -o test.zip` / 131072" | bc | xargs -I {} echo `date` {} Mb\/s >> $LOG
rm ./test.zip
numberPuzzle=function(a){var b=function(a){var b=parseInt(a,10);if(b===8){return 2}else if(b===6||b===9||b===0){return 1}return 0};var c=function(a){var b=0;var c;for(c=0;c<a.length;c+=1){b+=a[c]}return b};return c(String(a).split("").map(b))}