Skip to content

Instantly share code, notes, and snippets.

View EmbeddedLinuxGuy's full-sized avatar

Jesse Zbikowski EmbeddedLinuxGuy

View GitHub Profile
@ChrisPenner
ChrisPenner / kleisli-endo.md
Last active October 22, 2019 03:44
Kleisli Endo

After listening to the latest Magic Read-along episode "You should watch this" (which you should go listen to now) I got caught up thinking about Brian's idea of an Endomorphism version of Kleisli composition for use with Redux, it's actually a very similar model to what I'm using in my event framework for event listeners so I figured I'd try to formalize the pattern and recognize some of the concepts involved. IIRC Brian described the idea of a Redux-reducer, which is usually of type s -> Action -> s, it takes a state and an action and returns a new state. He then re-arranged the arguments to Action -> s -> s. He then recognized this as Action -> Endo s (an Endo-morphism is just any function from one type to itself: a -> a). He would take his list of reducers and partially apply them with the Action, yielding a list of type Endo s where s

@edwthomas
edwthomas / chart_reframe.cljs
Created June 7, 2016 20:43
Using CLJS and Re-frame to call third-part JS library (Chartist.js)
(:require [re-frame.core :as re-frame]
[reagent.core :as reagent]
[cljsjs.chartist])
(defn show-chart
[]
(let [chart-data {:labels ["Mar-2012" "Jun-2012" "Nov-2012" "Oct-2013" "Nov-2014"]
:series [[1 1 6 15 25]]}
options {:width "700px"
:height "380px"}]
@gerbsen
gerbsen / ssh_agent_start.fish
Last active July 16, 2024 16:52 — forked from schaary/ssh_agent_start.fish
Auto-launching ssh-agent in fish shell
# content has to be in .config/fish/config.fish
# if it does not exist, create the file
setenv SSH_ENV $HOME/.ssh/environment
function start_agent
echo "Initializing new SSH agent ..."
ssh-agent -c | sed 's/^echo/#echo/' > $SSH_ENV
echo "succeeded"
chmod 600 $SSH_ENV
. $SSH_ENV > /dev/null
@nadeem-khan
nadeem-khan / When to 'git rebase' instead of 'git merge'.md
Last active February 25, 2018 04:47
When to 'git rebase' instead of 'git merge'?

git tree at default when we have not merged nor rebased:

git tree at default when we have not merged nor rebased

we get by rebasing:

we get by rebasing

@tadly
tadly / pacaur_install.sh
Last active August 30, 2023 13:15
A simple shell script to quickly / easily install "pacaur" on archlinux
#!/bin/sh
#
# !!! IMPORTANT !!!
# As of 2017-12-14, pacaur is unmaintained (https://bbs.archlinux.org/viewtopic.php?pid=1755144#p1755144)
# For alternatives see the arch wiki: https://wiki.archlinux.org/index.php/AUR_helpers#Active
# pacaur seems to get occasional updates to fix breaking changes due to pacman updates though.
#
# If you are new to arch, I encourage you to at least read and understand what
# this script does befor blindley running it.
# That's why I didn't make a one-liner out of it so you have an easier time
@mausch
mausch / Coffeescript.coffee
Created May 25, 2012 22:45
Church-encoded numbers as a measure of 'how functional is a language' http://stackoverflow.com/a/6166222/21239
# Careful with the spaces!
thrice = (f) -> (x) -> f(f(f(x)))
_3 = thrice((x) -> x + 1) 0
_9 = thrice(thrice((x) -> x + 1)) 0
_27 = (thrice thrice)((x) -> x + 1) 0
@sontek
sontek / snowjob.sh
Last active August 9, 2024 13:14
Make your terminal snow
#!/bin/bash
LINES=$(tput lines)
COLUMNS=$(tput cols)
declare -A snowflakes
declare -A lastflakes
clear
@nicerobot
nicerobot / chrome-cookies.sh
Created December 7, 2011 16:59
Convert Google Chrome sqlite Cookies into cookies.txt. Useful for utilities like curl.
sqlite3 -separator ' ' ${COOKIES:-Cookies} \
'select host_key, "TRUE", path, "FALSE", expires_utc, name, value from cookies'