Skip to content

Instantly share code, notes, and snippets.

View amokan's full-sized avatar

Adam Mokan amokan

  • Grain
  • Chandler, Arizona
  • 05:53 (UTC -07:00)
View GitHub Profile
@amokan
amokan / !norns_on_mac.md
Last active June 10, 2020 22:41 — forked from mimetaur/!norns_on_mac.md
Norns Engine Development on MacOS - quick guide
  1. Pull the norns repository

  2. Make symbolic links from norns sc folders -> SuperCollider Extensions folder:

    • ln -s ~/development/github/monome/norns/sc/core ~/Library/Application\ Support/SuperCollider/Extensions/monome-norns-core
    • ln -s ~/development/github/monome/norns/sc/engines ~/Library/Application\ Support/SuperCollider/Extensions/monome-norns-engines
    • ln -s ~/development/github/monome/norns/sc/ugens ~/Library/Application\ Support/SuperCollider/Extensions/monome-norns-ugens
  3. Make symlinks to Norns community repos e.g. ln -s ~/development/github/monome/we/ ~/Library/Application\ Support/SuperCollider/Extensions/monome-we

  4. Make symlinks for custom engine development

@amokan
amokan / README.md
Last active March 14, 2019 18:48
Throughput Monitor

Simple and Dumb Throughput Counter

Concurrent and simple. No blocking calls or bottlenecks. Increments are atomic.

Usage

Start up the proc

Throughput.start_link()
@amokan
amokan / grocery_cart_new.ex
Last active July 21, 2022 11:12
Comparison of GenServer state orchestration using send/2 vs the new handle_continue callback
defmodule GroceryCart do
@moduledoc """
Simple example showing the `handle_continue` callback in Erlang/OTP 21+
"""
use GenServer
# simple contrived struct for state - didn't need to be a struct at all
defstruct items: []

Keybase proof

I hereby claim:

  • I am amokan on github.
  • I am adammokan (https://keybase.io/adammokan) on keybase.
  • I have a public key ASCDszyHtTcwLmTxn1kECbHYTro7_6FSJxj5V60s5IUmRQo

To claim this, I am signing this object:

### Keybase proof
I hereby claim:
* I am amokan on github.
* I am adammokan (https://keybase.io/adammokan) on keybase.
* I have a public key ASB_7ehK1iFhL1_xk7Z3P1gKUnSfUUTLuwjszBoD2fdczgo
To claim this, I am signing this object:
@amokan
amokan / html_to_md
Created October 12, 2017 14:47
web url to markdown command line function
#!/bin/zsh -e
function clipcopy() {
emulate -L zsh
local file=$1
if [[ $OSTYPE == darwin* ]]; then
if [[ -z $file ]]; then
pbcopy
else
cat $file | pbcopy
@amokan
amokan / stream_test.ex
Last active February 22, 2017 19:28 — forked from refriedchicken/stream_test.ex
Streaming Size Check
defmodule StreamTest do
use GenServer
require Logger
def start_link(opts \\ []) do
GenServer.start_link(__MODULE__, :ok, opts)
end
def init(:ok) do
Process.flag :trap_exit, true
defmodule StageB do
@moduledoc """
An updated version of Stage (B) from the post at
https://medium.com/@adammokan/genstage-alternatives-to-parallel-stages-6689f8eabdbd
Hope this example helps, but understand that I just wrote this on the fly and it may or may not contain bugs.
I tried to comment thouroughly so you should have no trouble implementing on your own.
"""
alias Experimental.GenStage
@amokan
amokan / README.md
Created April 25, 2016 18:53
Elixir Crawling With Pools For Fun and Profit

PoolCrawler

This is a simple example in response to https://www.reddit.com/r/elixir/comments/4gcnmi/struggling_with_getting_this_worker_pool_and/ as well as a reminder for myself

I used https://github.com/midas/conqueuer to do something similar to the original poster was trying to accomplish.

Some code has been removed to make it simple to follow and just dropping this into a project will not compile. Be sure to look at the comments.

I combined and/or renamed files in this gist to group things together as well.

@amokan
amokan / Preferences.sublime-settings
Created September 16, 2015 15:40
preferences.sublime-settings
{
"auto_complete_commit_on_tab": true,
"auto_indent": true,
"bold_folder_labels": true,
"close_windows_when_empty": false,
"color_scheme": "Packages/User/SublimeLinter/Solarized (Dark) (SL).tmTheme",
"default_encoding": "UTF-8",
"default_line_ending": "unix",
"draw_white_space": "all",
"ensure_newline_at_eof_on_save": true,