This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# Analyze heap dumps for memory leaks | |
# | |
# Gather the memory dumps with | |
# bundle exec rbtrace — timeout 30 -e ‘load “#{Rails.root}/scripts/heap_dump.rb”’ -p $RAILS_PID | |
require 'set' | |
require 'json' | |
if ARGV.length != 3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function forecastUrl(apiKey, location) { | |
var apiUrl = "https://api.forecast.io/forecast"; | |
var excludeFields = "exclude=minutely,hourly"; | |
return apiUrl + "/" + apiKey + "/" + location + "?" + excludeFields; | |
} | |
function getForecast(url) { | |
var got = require("got"); | |
return got(url) | |
.then(function (response) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Pass through all data from USB serial to UART serial (TX/RX pins) | |
*/ | |
SYSTEM_THREAD(ENABLED); | |
SYSTEM_MODE(MANUAL); | |
void setup() { | |
Serial1.begin(9600); | |
Serial.begin(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "application.h" | |
#include "nrfx_pwm.h" | |
#include "nrf_gpio.h" | |
#include "pinmap_impl.h" | |
SYSTEM_MODE(MANUAL); | |
#define PIXEL_COUNT 44 | |
#define BITS_PER_PIXEL 24 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Build with | |
// particle compile photon . build.mk | |
void setup() { | |
pinMode(BLINK_PIN, OUTPUT); | |
} | |
void loop() { | |
digitalWrite(BLINK_PIN, HIGH); | |
delay(1000); | |
digitalWrite(BLINK_PIN, LOW); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# UDEV Rules for Particle boards | |
# | |
# This will allow reflashing with DFU-util without using sudo | |
# | |
# The latest version of this file may be found at: | |
# https://gist.github.com/monkbroc/b283bb4da8c10228a61e | |
# | |
# This file must be placed at: | |
# | |
# /etc/udev/rules.d/50-particle.rules (preferred location) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Simple webserver that logs all requests to /hook to a file | |
* Usage: | |
* npm install express | |
* node server.js | |
*/ | |
var express = require('express'); | |
var fs = require('fs'); | |
var app = express(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Save as ~/bin/git-amend then chmod +x ~/bin/git-amend | |
# Usage: `git amend` to silently amend a previous commit | |
git commit --amend --no-edit $* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Extract the Slack message history per channel for a time period | |
// Gives an idea which Slack channels are most used | |
// Usage: | |
// Save SLACK_TOKEN in .env file | |
// npm install | |
// npm start | tee slack_channels.csv | |
const WebClient = require('@slack/client').WebClient; | |
const Promise = require('bluebird'); | |
const moment = require('moment'); |
NewerOlder