Skip to content

Instantly share code, notes, and snippets.

View poppingtonic's full-sized avatar
💭
👟

Brian Muhia poppingtonic

💭
👟
View GitHub Profile
@poppingtonic
poppingtonic / makehub
Created February 5, 2014 08:15
Animalator
# Title
Animalator
# Picture
media: undefined
# Objective
A way for kids to interact with pictures of animals that they recognize, in interesting ways.
# Duration
1-2 hours
# Age Group
all
(ns slack
(:require [clj-http.client :as client]
[clojure.data.json :as json]))
(defn send-to-slack
"Sends a simple message to slack using an 'incoming webhook'.
url will be of form: https://myapp.slack.com/services/hooks/incoming-webhook?token=mytoken .
(Exact url you should use will appear on the slack integration page)
text will be any valid message.
This implementation could be expanded if you wanted to specify channel, username, etc.
module Botworld where
import Control.Applicative ((<$>), (<*>))
import Control.Monad (join)
import Control.Monad.Reader (Reader, asks)
import Data.List (delete, elemIndices, intercalate, sortBy)
import Data.List.Split (chunksOf)
import Data.Maybe (catMaybes, isJust, fromMaybe, mapMaybe)
import Data.Ord (comparing)
import Text.Printf (printf)
// by dave @ beesandbombs.tumblr.com >:)
void setup() {
setup_();
result = new int[width*height][3];
result_ = new int[width*height][3];
}
int[][] result, result_;
float time;
(ns om-data.core
(:require [om.core :as om :include-macros true]
[om.dom :as dom :include-macros true]
[datascript :as d]))
(enable-console-print!)
(def schema {})
(def conn (d/create-conn schema))
# RSpec 2.0 syntax Cheet Sheet by http://ApproachE.com
# defining spec within a module will automatically pick Player::MovieList as a 'subject' (see below)
module Player
describe MovieList, "with optional description" do
it "is pending example, so that you can write ones quickly"
it "is already working example that we want to suspend from failing temporarily" do
pending("working on another feature that temporarily breaks this one")
@poppingtonic
poppingtonic / eshell-here.el
Created May 6, 2015 13:52
Open eshell in the current directory
(defun eshell-here ()
"Opens up a new shell in the directory associated with the
current buffer's file. The eshell is renamed to match that
directory to make multiple eshell windows easier."
(interactive)
(let* ((parent (if (buffer-file-name)
(file-name-directory (buffer-file-name))
default-directory))
(height (/ (window-total-height) 3))
(name (car (last (split-string parent "/" t)))))
@poppingtonic
poppingtonic / README
Last active August 29, 2015 14:21 — forked from mremond/README
Please read original blog post for reference:
http://blog.process-one.net/embedding-ejabberd-into-an-elixir-phoenix-web-application/
@poppingtonic
poppingtonic / parsel.sql
Created March 7, 2016 06:12
Parsel: A Simple Function for Parallel Query in Postgres using Dblink
-- DROP FUNCTION IF EXISTS public.parsel(db text, table_to_chunk text, pkey text, query text, output_table text, table_to_chunk_alias text, num_chunks integer);
CREATE OR REPLACE FUNCTION public.parsel(db text, table_to_chunk text, pkey text, query text, output_table text, table_to_chunk_alias text default '', num_chunks integer default 2)
RETURNS text AS
$BODY$
DECLARE
sql TEXT;
min_id integer;
max_id integer;
step_size integer;
lbnd integer;
@poppingtonic
poppingtonic / passphrase_gen.py
Last active August 1, 2019 19:45
This script generates a list of 9 words as a "strong-enough" passphrase generator. My attempt, based on python 3.6's secrets module, to justifiably disobey the Diceware recommendation against computer-based RNGs: http://world.std.com/~reinhold/diceware.html
#!/usr/bin/env python
# requires python 3.6 and requests
import os
import re
import secrets
import requests
wordlist_file = 'diceware.wordlist.asc'