Skip to content

Instantly share code, notes, and snippets.

@jgreat
jgreat / 00-prerequisites.md
Last active October 14, 2019 19:37
Rancher install with helm

Prerequisits

Describe installs for.

  • rke
  • kubectl
  • helm
@xsot
xsot / instructions.md
Last active March 3, 2024 13:42
sed maze solver

Usage

sed -E -f solver.sed input where input is a file containing the maze.

For best results, resize your terminal to match the height of the maze. To disable animations, delete the lines containing p.

Maze format

The solver assumes the following:

  • The maze only contains the characters # \nSE
  • Every line has the same number of characters
  • There is only one start (S) and end (E)
@prasmussen
prasmussen / decrypt.js
Last active January 8, 2019 20:32
Decrypt blockstack encryptedPortalKey
var triplesec = require('triplesec');
var encryptedPortalKey = new Buffer("<encryptedPortalKey>", "hex");
var password = new Buffer("<password>");
triplesec.decrypt({key: password, data: encryptedPortalKey}, function(err, plaintext) {
if (err) {
console.log(err);
} else {
console.log("Your backup phrase:");
@kimus
kimus / ufw.md
Created March 2, 2014 22:46
NAT and FORWARD with Ubuntu’s ufw firewall

UFW

I use Ubuntu’s Uncomplicated firewall because it is available on Ubuntu and it's very simple.

Install UFW

if ufw is not installed by default be sure to install it first.

@adamalbrecht
adamalbrecht / ngDebounce.js
Last active December 9, 2022 20:16
Simple debounce function for Angular.js found at the link below and slightly tweaked. http://plnkr.co/edit/fJwRER?p=info
// Returns a function, that, as long as it continues to be invoked, will not
// be triggered. The function will be called after it stops being called for
// N milliseconds. If `immediate` is passed, trigger the function on the
// leading edge, instead of the trailing.
angular.module('ngDebounce', []).factory('$debounce', function($timeout, $q) {
return function(func, wait, immediate) {
var timeout;
var deferred = $q.defer();
return function() {
var context = this, args = arguments;
@kran
kran / lua-resty-router.lua
Last active April 30, 2017 00:37
router for openresty, dev state
local ngx = require"ngx"
local setmetatable = setmetatable
local insert = table.insert
local pairs = pairs
local ipairs = ipairs
local type = type
local strlen = string.len
local substr = string.sub
local pp = require'prettyprint'
local match = string.match
@anotheremily
anotheremily / Coffee Sheets Example.md
Last active December 14, 2015 22:19
CoffeeSheets Example - Literate Example

Stylesheet for [name of project]

These are the main styles for the home page

class CoffeeSheetsExampleBaseClass extends CoffeeSheetStyleSheet {

This will execute on every page load generating beautiful styles for all!

   public void main () {
@josegonzalez
josegonzalez / access.lua
Created December 3, 2012 18:26
Simple lua file enabling oauth support for nginx via nginx-lua and access_by_lua.
- certain endpoints are always blocked
if nginx_uri == "/_access_token" or nginx_uri == "/_me" then
ngx.exit(403)
end
-- import requirements
local cjson = require "cjson"
-- setup some app-level vars
local app_id = "APP_ID"
@runfalk
runfalk / jsonsession.py
Created April 26, 2012 18:52
JSON session cookie for Flask, instead of pickle
# Assumes app = Flask(...)
import json
from flask.sessions import SecureCookieSession, SecureCookieSessionInterface
class JSONSecureCookieSession(SecureCookieSession):
serialization_method = json
class JSONSecureCookieSessionInterface(SecureCookieSessionInterface):
session_class = JSONSecureCookieSession
@addyosmani
addyosmani / pubsub.md
Created October 28, 2011 06:49
Four ways to do Pub/Sub with jQuery 1.7 and jQuery UI (in the future)

#Four Ways To Do Pub/Sub With jQuery and jQuery UI (in the future)

Between jQuery 1.7 and some of work going into future versions of jQuery UI, there are a ton of hot new ways for you to get your publish/subscribe on. Here are just four of them, three of which are new.

(PS: If you're unfamiliar with pub/sub, read the guide to it that Julian Aubourg and I wrote here http://msdn.microsoft.com/en-us/scriptjunkie/hh201955.aspx)

##Option 1: Using jQuery 1.7's $.Callbacks() feature:

$.Callbacks are a multi-purpose callbacks list object which can be used as a base layer to build new functionality including simple publish/subscribe systems. We haven't yet released the API documentation for this feature just yet, but for more information on it (including lots of examples), see my post on $.Callbacks() here: