Skip to content

Instantly share code, notes, and snippets.

View jkeefe's full-sized avatar

John Keefe jkeefe

View GitHub Profile
@vlucas
vlucas / encryption.js
Last active April 2, 2024 14:26
Stronger Encryption and Decryption in Node.js
'use strict';
const crypto = require('crypto');
const ENCRYPTION_KEY = process.env.ENCRYPTION_KEY; // Must be 256 bits (32 characters)
const IV_LENGTH = 16; // For AES, this is always 16
function encrypt(text) {
let iv = crypto.randomBytes(IV_LENGTH);
let cipher = crypto.createCipheriv('aes-256-cbc', Buffer.from(ENCRYPTION_KEY), iv);
@konklone
konklone / nagw-eric-mill-https-2015.md
Created October 7, 2015 00:33
Links and resources from Eric Mill's talk on HTTPS in .gov, given at NAGW 2015.

HTTPS for .gov

Talk given by Eric Mill at the National Association of Government Web Professionals (NAGW) 2015 conference in Albuqerque, New Mexico.

Resources

@tracker1
tracker1 / 01-directory-structure.md
Last active April 26, 2024 21:26
Anatomy of a JavaScript/Node project.

Directory structure for JavaScript/Node Projects

While the following structure is not an absolute requirement or enforced by the tools, it is a recommendation based on what the JavaScript and in particular Node community at large have been following by convention.

Beyond a suggested structure, no tooling recommendations, or sub-module structure is outlined here.

Directories

  • lib/ is intended for code that can run as-is
  • src/ is intended for code that needs to be manipulated before it can be used
@grenade
grenade / 01-generate-ed25519-ssh-key.sh
Last active May 2, 2024 23:15
generate ed25519 ssh and gpg/pgp keys and set file permissions for ssh keys and config
#!/bin/bash
# generate new personal ed25519 ssh key
ssh-keygen -o -a 100 -t ed25519 -f ~/.ssh/id_ed25519 -C "rob thijssen <rthijssen@gmail.com>"
# generate new host cert authority (host_ca) ed25519 ssh key
# used for signing host keys and creating host certs
ssh-keygen -t ed25519 -f manta_host_ca -C manta.network
eval "$(ssh-agent -s)"
@Chicago
Chicago / gist:1165275
Created August 23, 2011 14:29
Crimes - Sample R code - Pie Chart
##Quick and easy way to visualize the crimes data set using open source techniques
##Have more ideas? Tell me about them at @ChicagoCDO
##All you need to do is install R at http://cran.r-project.org/ and run this file
install.packages("googleVis")
library(googleVis)
crimes_stage <- read.csv("http://data.cityofchicago.org/views/x2n5-8w5q/rows.csv")
attach(crimes_stage)
##remove first row with column names
crimes <- crimes_stage[-c(1),]
##create frequency table from crime
@biovisualize
biovisualize / index.html
Created June 9, 2011 14:42
Simple D3 tooltip
<!DOCTYPE html>
<html >
<head>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js"></script>
</head>
<body>
<div class="example_div"></div>
<script type="text/javascript">
var tooltip = d3.select("body")
.append("div")
ogr2ogr -wrapdateline -t_srs EPSG:4326 nyzd_4326.shp nyzd.shp
#!/usr/bin/env ruby
require 'net/ftp'
def get_roads
`cd shapes`
ftp = Net::FTP.new('ftp2.census.gov')
ftp.login
files = ftp.chdir("/geo/tiger/TIGER2010/ROADS")
files = ftp.list.collect {|r| r.match(/tl.*$/)[0]}
require 'rubygems'
require 'yajl/json_gem'
module AP
# a = AP::ParseData.new('/file.txt')
class ParseData
def initialize(file)
@file = file
@ap_scratch = []
@final_results = []