Skip to content

Instantly share code, notes, and snippets.

View amokan's full-sized avatar

Adam Mokan amokan

  • Grain
  • Chandler, Arizona
  • 03:04 (UTC -07:00)
View GitHub Profile
@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 / 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,
#!/usr/bin/env knife exec
# A knife exec script to change chef node's name, preserving all the attributes.
#
# Usage: knife exec rename-node.rb old-name new-name
#
# Script retrieves the Node object, changes its 'name' attribute,
# creates new Node object with updated name and rest of attributes
# untouched. Then it deletes old Node and Client objects from
# database, and logs into the server to update it:
if [ -f "$rvm_path/scripts/rvm" ]; then
source "$rvm_path/scripts/rvm"
if [ -f ".rvmrc" ]; then
source ".rvmrc"
fi
if [ -f ".ruby-version" ]; then
rvm use `cat .ruby-version`
fi

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
#include <Shieldbot.h>
#include <Wire.h>
#define UNO32_DEVICE 4
#define SENSOR_1 1
#define SENSOR_2 2
#define SENSOR_3 3
#define SENSOR_4 4
#define SENSOR_5 5
# This file is for unifying the coding style for
# different editors and IDEs
#
# editorconfig.org
root = true
[*]
end_of_line = lf
charset = utf-8
@amokan
amokan / gist:3902689
Created October 16, 2012 23:16 — forked from dgalarza/gist:3248130
update jenkins Updatecenter from CLI
$ java -jar jenkins-cli.jar -s http://localhost:9000 install-plugin findbugs
findbugs is neither a valid file, URL, nor a plugin artifact name in the update center
No update center data is retrieved yet from: http://updates.jenkins-ci.org/update-center.json
findbugs looks like a short plugin name. Did you mean 'null'?
# Specifying a full URL works!
$ java -jar jenkins-cli.jar -s http://localhost:9020 install-plugin http://updates.jenkins-ci.org/download/plugins/AdaptivePlugin/0.1/AdaptivePlugin.hpi
# Get the update center ourself