Skip to content

Instantly share code, notes, and snippets.

@scottb
scottb / app-assets-javascripts-application.js
Created September 7, 2011 15:48
Getting Dojo to work with Rails 3.1 and Sprockets
//= require_directory .
dojo.require('dojox.rails');
@brentertz
brentertz / rvm2rbenv.txt
Created November 21, 2011 23:00
Switch from RVM to RBENV
## Prepare ###################################################################
# Remove RVM
rvm implode
# Ensure your homebrew is working properly and up to date
brew doctor
brew update
## Install ###################################################################
@willb
willb / backup-db.rb
Created August 29, 2012 21:00
Backup script for SQLite databases
#!/usr/lib/env ruby
# Acquires a shared lock on a SQLite database file and copies it to a backup
# usage: backup-db.rb DBFILE.db BACKUPFILE.db
# author: William Benton (willb@redhat.com)
# Public domain.
require 'sqlite3'
require 'fileutils'
@mswietlicki
mswietlicki / AsyncExtensions.cs
Created July 30, 2013 12:52
InCompletionOrder allows you to do foreach on collection of Tasks that will process them as fast as they complete.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
namespace Asyncfun
{
public static class AsyncExtensions
{
@kll
kll / iam-store-credentials.sh
Last active May 15, 2018 02:18
Fetches the IAM instance profile provided credentials inside of an EC2 instance and stores them in environment variables. usage: source iam-store-credentials.sh
#!/bin/bash
IAM_INFO=$(GET http://169.254.169.254/latest/meta-data/iam/info)
IAM_INSTANCE_PROFILE=$(echo "${IAM_INFO}" | sed -n 's_^[^/]*/\([^"]*\)".*_\1_p')
IAM_CREDENTIALS_URL="http://169.254.169.254/latest/meta-data/iam/security-credentials/$IAM_INSTANCE_PROFILE"
IAM_CREDENTIALS=$(GET $IAM_CREDENTIALS_URL)
export AWS_ACCESS_KEY=$(echo "${IAM_CREDENTIALS}" | sed -n 's_.*"AccessKeyId" : "\([^"]*\)".*_\1_p')
export AWS_SECRET_KEY=$(echo "${IAM_CREDENTIALS}" | sed -n 's_.*"SecretAccessKey" : "\([^"]*\)".*_\1_p')
export AWS_DELEGATION_TOKEN=$(echo "${IAM_CREDENTIALS}" | sed -n 's_.*"Token" : "\([^"]*\)".*_\1_p')
@smittytone
smittytone / ssd1306.device.nut
Last active August 29, 2015 14:02
Electric Imp Squirrel class for the SSD1306 OLED controller
class SSD1306_OLED
{
// Squirrel Class for Solomon SSD1306 OLED controller chip
// [http://www.adafruit.com/datasheets/SSD1306.pdf]
// As used on the Adafruit SSD1306 I2C breakout board
// [http://www.adafruit.com/products/931]
// Bus: I2C
// Code by Tony Smith (@smittytone) June 2014
// Version 1.0.2
@judy2k
judy2k / parse_dotenv.bash
Created March 22, 2017 13:34
Parse a .env (dotenv) file directly using BASH
# Pass the env-vars to MYCOMMAND
eval $(egrep -v '^#' .env | xargs) MYCOMMAND
# … or ...
# Export the vars in .env into your shell:
export $(egrep -v '^#' .env | xargs)
@DesignByOnyx
DesignByOnyx / README.md
Last active December 26, 2021 02:11
A script for setting up a project to use semantic-ui-less

This script was inspired by this blog post - however I found the technique to be a little insufficient. Many thanks to Artem Butusov as I would not have been able to do this without his blog post.

This script is intended to be used with semantic-ui-react projects. If you are just using semantic-ui, then you may need to do some other troubleshooting... I don't know as I haven't tested. From what I can tell everything should work just fine.

Before we get started

This process is completely different from the one described in the blog post above. This script is intended to do everything for you - no manual copying or updating code is required. If you have already followed

@clarkdave
clarkdave / load-balanced-pgbouncer-ecs.tf
Last active March 16, 2023 20:08
[Terraform] Load balanced PgBouncer service on Amazon ECS
#
# Reference implementation of a load balanced PgBouncer service on Amazon ECS
#
# see: https://engineering.loyaltylion.com/load-balanced-pgbouncer-service-on-amazon-ecs-f02120d1733e
#
resource "aws_lb" "pgbouncer" {
name = "${var.environment}-pgbouncer"
internal = true
load_balancer_type = "network"
@joshschools
joshschools / moonraker.cfg
Last active March 11, 2024 23:45
Klipper Configs
[server]
host: 0.0.0.0
port: 7125
enable_debug_logging: False
[file_manager]
config_path: ~/klipper_config
log_path: ~/klipper_logs
[data_store]