Skip to content

Instantly share code, notes, and snippets.

View fairchild's full-sized avatar

Michael Fairchild fairchild

  • Procore
  • California
View GitHub Profile
anonymous
anonymous / main.js
Created November 24, 2014 22:25
AWS Lambda Functions in Go
var exec = require('child_process').exec;
console.log('Loading event');
exports.handler = function(event, context) {
eventJSON = JSON.stringify(event);
exec('./test ' + eventJSON, function callback(error, stdout, stderr) {
console.log('stdout: ' + stdout);
console.log('stderr: ' + stderr);
@sberke
sberke / Demo of plantUML in ipython notebook.ipynb
Last active December 9, 2020 01:46
Demo of plantUML in ipython notebook
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@dgraham
dgraham / fetch.js
Last active March 24, 2023 15:44
Simple window.fetch wrapper.
(function() {
function status(response) {
if (response.ok) {
return response
} else {
var error = new Error(response.statusText || response.status)
error.response = response
throw error
}
}
@tobiashm
tobiashm / node_modules.rb
Last active October 26, 2023 22:26
Add node modules to Rails assets paths
# Allow Rails to use assets from Node packages
package_json = Rails.root.join("package.json")
Rails.configuration.watchable_files << package_json
Rails.configuration.to_prepare do
node_config = JSON.parse(package_json.read)
paths = Rails.configuration.assets.paths
node_modules = Rails.root.join("node_modules")
paths.reject! { |p| p.to_s.start_with?(node_modules.to_s) }
node_config["dependencies"].keys.each do |node_module|
module_dir = node_modules.join(node_module)
@srinivasmohan
srinivasmohan / thumbnail.rb
Created September 4, 2014 19:12
ffmpeg screenshots
#!/usr/bin/ruby
require "streamio-ffmpeg"
class Video
def initialize(f="", outf="./", at=[20, 50, 80])
@video=FFMPEG::Movie.new(f)
@at=at.map { |x| (@video.duration*x/100).to_i}
$stderr.puts "Video #{f} (#{@video.duration} secs) - Screenshots at #{@at.inspect}"
@outf=outf
@tstellanova
tstellanova / jetson_kernel_install.md
Last active February 12, 2016 14:04
Howto install grinch alternative kernel on NVIDIA Jetson TK1 (supports many wifi devices, USB3 by default)

For this process you will need:

  • A flashing computer, preferably an Ubuntu Linux machine (or VM)
  • Micro USB cable, same as the one provided with the Jetson TK1 kit
  • Jetson TK1 and power supply
  • Optional: DB9 null modem cable
  1. Download NVIDIA Linux4Tegra (L4T) Board Support Package (BSP) and Sample Root Filesystem from NVIDIA

wget https://developer.nvidia.com/sites/default/files/akamai/mobile/files/L4T/Tegra124_Linux_R19.3.0_armhf.tbz2
@rodneyrehm
rodneyrehm / gist:40e7946c0cff68a31cea
Last active March 12, 2025 19:23
Diagrams for Documentation

some tools for diagrams in software documentation

Diagrams For Documentation

Obvious Choices

ASCII

@straydogstudio
straydogstudio / with_runner.rb
Last active April 13, 2023 02:31
Render template inside a Rails runner script
view_assigns = {widgets: Widget.all}
av = ActionView::Base.new(ActionController::Base.view_paths, view_assigns)
av.class_eval do
# include any needed helpers (for the view)
include ApplicationHelper
end
# normal render statement
content = av.render template: 'widgets/index.xlsx.axlsx'
# do something with content, such as:
@dhoelzgen
dhoelzgen / base_controller.rb
Last active October 7, 2021 16:19
CORS in Rails 4 APIs
class API::V1::BaseController < ApplicationController
skip_before_filter :verify_authenticity_token
before_filter :cors_preflight_check
after_filter :cors_set_access_control_headers
def cors_set_access_control_headers
headers['Access-Control-Allow-Origin'] = '*'
headers['Access-Control-Allow-Methods'] = 'POST, GET, PUT, DELETE, OPTIONS'