Skip to content

Instantly share code, notes, and snippets.

View seigel's full-sized avatar

James Seigel seigel

View GitHub Profile
@seigel
seigel / Brewfile
Created December 25, 2019 21:04 — forked from miry/Brewfile
MacOS Brewfile to install default applications. https://github.com/Homebrew/homebrew-bundle
cask_args appdir: "~/Applications"
tap "caskroom/cask"
cask 'sqleditor'
cask 'google-chrome'
cask 'homebrew/cask-versions/firefox-developer-edition'
# cask 'resilio-sync'
cask 'keybase'
# cask 'dashlane'
cask 'visual-studio-code'
var brain = require('brain.js')
var fs = require('fs')
// configuration to be used in the brain
const config = {
binaryThresh: 0.5, // arbitary value
hiddenLayers: [3], // the size of the hidden layers in the network
activation: 'sigmoid' // activation function
}
@seigel
seigel / nodebot.js
Created October 25, 2018 21:08 — forked from Rup1/nodebot.js
Preliminary script. File-watching specific folder using Chokidar, and automating Apple Mail using JXA.
var osa = require('osa2');
var fs = require('fs');
var chokidar = require('chokidar');
var watcher = chokidar.watch('/Users/rup/Desktop/trolls', {
ignored: /(^|[\/\\])\../,
ignoreInitial: true,
persistent: true,
});
@seigel
seigel / application_helper.rb
Created October 1, 2018 19:21 — forked from exocode/application_helper.rb
Render with ``render_to_string`` a complete page within a sidekiq worker including current_user
module ApplicationHelper
def current_user
@current_user ||= warden.authenticate(:scope => :user)
end
end

Effective Engineer - Notes

What's an Effective Engineer?

  • They are the people who get things done. Effective Engineers produce results.

Adopt the Right Mindsets

@seigel
seigel / react-redux-style-guide.md
Last active December 10, 2017 05:34 — forked from datchley/react-redux-style-guide.md
React + Redux Style Guide
@seigel
seigel / clamav-mac.md
Last active January 18, 2017 23:54 — forked from Uchean/clamav-mac.md
Get ClamAV running on Mac OS X (using Homebrew)

Get ClamAV running on Mac OS X (using Homebrew)

The easiest way to get the ClamAV package is using Homebrew

$ brew install clamav

Before trying to start the clamd process, you'll need a copy of the ClamAV databases.

Create a freshclam.conf file and configure as so

@seigel
seigel / card-present.md
Created October 30, 2016 05:37
Stripe card-present API

Sending swiped card data to Stripe

Stripe's API supports sending both typed and swiped card data. Typed data is recorded when your customer enters their card details on your site and the data is sent to Stripe either by Stripe.js or through the Stripe API:

https://stripe.com/docs/api#create_charge

Swiped data is sent to Stripe when you have your own card swipe that reads the magnetic card strip on the back of your customers' cards. The raw output of the card swipe can then be submitted to the Stripe API.

The data contained on the magnetic strip of a card contains similar details to those embossed on the card but with some additions and repetitions. Details on the magnetic strip data can be found here:

@seigel
seigel / pg_index_cache_hit_rate.sql
Created December 4, 2015 03:53 — forked from mattsoldo/pg_index_cache_hit_rate.sql
Postgres Index Hit Rate and Cache Hit Rate
-- Index hit rate
WITH idx_hit_rate as (
SELECT
relname as table_name,
n_live_tup,
round(100.0 * idx_scan / (seq_scan + idx_scan),2) as idx_hit_rate
FROM pg_stat_user_tables
ORDER BY n_live_tup DESC
),
@seigel
seigel / nginx_site
Created March 8, 2012 06:12 — forked from nicolasblanco/nginx_site
My Sprinkle script to setup a Continuous Integration server with Ruby 1.9/Jenkins/nginx/PostgreSQL
# Sprinkle setup script for our CI server (Ruby 1.9/Git/PostgreSQL/nginx reverse proxy)
#
package :build_essential do
description 'Build tools'
apt 'build-essential' do
# Update the sources and upgrade the lists before we build essentials
pre :install, ['aptitude update', 'aptitude safe-upgrade', 'aptitude full-upgrade']
end
end