Skip to content

Instantly share code, notes, and snippets.

@louiskirsch
louiskirsch / txt-to-slides.sh
Last active December 12, 2020 17:05
Convert dynalist exported plain text with spaces to remark presentation
#!/bin/bash
name=${1:-slides}
replace='s/^([^ ].*)/# \1§/g; s/^ {8}([^ ].*)/§### \1§/g; s/^ {4}([^ ].*)/§## \1§/g; s/ +(\![[])/\1/g; s/ {12}([^ ]+)/- \1/g; s/\![(]([0-9-]+)[)]/\1/g'
sed -E "$replace" <&0 | tr "§" "\n" > $name.md
markdown-to-slides -d $name.md -o $name.html
open $name.html
@oviava
oviava / redux-socket.jsx
Last active November 12, 2017 05:24
handling socket events with redux
const types = {
ADD_TODO: 'ADD_TODO',
DELETE_TODO: 'DELETE_TODO',
COMPLETE_TODO: 'COMPLETE_TODO',
};
const socketEvents = {
ADD_TODO_SUCCESS: 'ADD_TODO_SUCCESS',
ADD_TODO_FAIL: 'ADD_TODO_FAIL',
};
@alexhayes
alexhayes / README.md
Last active August 29, 2015 14:11
SLS require that only has an include fails

It appears that if you have a require with sls: foo and foo.sls itself only has include: statements the requirement fails.

When the command salt \* state.highstate test=True the following is output;

example.com:
----------
          ID: eggs
    Function: cmd.run
 Name: echo "I should be required..."
@alexhayes
alexhayes / SupervisordInstallationUbuntu12.04LTS.md
Last active April 7, 2020 14:20
Supervisord Installation on Ubuntu 12.04 LTS

Supervisord Installation on Ubutnu 12.04 LTS

There are a number of solutions for installing supervisord and automatically running it on Ubuntu - this is what worked for me (on multiple installations...).

Installation

Quick & Easy

sudo bash &lt; &lt;(curl https://gist.githubusercontent.com/alexhayes/814fd0d0f7020e918a95/raw/full-install.sh)
@randomecho
randomecho / australian-postcodes.sql
Last active April 11, 2024 12:08
Australian postcodes (with states and suburb names) geocoded with latitude and longitude.
/*
Taken and cribbed from blog.datalicious.com/free-download-all-australian-postcodes-geocod
May contain errors where latitude and longitude are off. Use at own non-validated risk.
*/
SET NAMES utf8;
SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
DROP TABLE IF EXISTS postcodes_geo;
@victorespigares
victorespigares / api.py
Created January 6, 2012 01:04
This snippet shows how to bootstrap your Backbone models with Tastypie. If you're using 'api_name' for the URL of your api, make sure you add it to the Resource meta, otherwise 'resource_uri' will be empty when accessing from the view, but not from api ur
class CourseResource(ModelResource):
class Meta:
queryset = Course.objects.all()
resource_name = 'courses'
# without this resource_uri is empty in the view!
api_name = settings.API_VERSION
@watson
watson / ability.rb
Created October 5, 2011 09:50
Active Admin CanCan integration with shared front/backend User model and multi-level autherization
# app/models/ability.rb
# All front end users are authorized using this class
class Ability
include CanCan::Ability
def initialize(user)
user ||= User.new
can :read, :all