Skip to content

Instantly share code, notes, and snippets.

View dexterous's full-sized avatar

Saager Mhatre dexterous

View GitHub Profile
# CLOSURES IN RUBY Paul Cantrell https://innig.net
# Email: username "paul", domain name "innig.net"
# I recommend executing this file, then reading it alongside its output.
#
# Alteratively, you can give yourself an unreasonable Ruby test by deleting all
# the comments, then trying to guess the output of the code!
#
# (Naive HR departments, please do not use that idea as a hiring quiz.)

Keybase proof

I hereby claim:

To claim this, I am signing this object:

@dexterous
dexterous / rotate.clj
Created August 31, 2022 06:21
Rotate a vector in Clojure
(defn rotate [v n]
(cond
(zero? n) v
(pos? n) (vec (concat (nthrest v n) (take n v)))
(neg? n) (rotate v (+ (count v) n))))
(defn how-not-to-factorial [x]
(condp #(< %2 %1) x
1 (throw (IllegalArgumentException.))
3 x
(loop [acc (bigint x) prev (dec x)]
(if (= prev 2) (* acc 2) (recur (* acc prev) (dec prev))))))
;; when you want to factorial...
(defn just-factorial [n] (apply * (range 1N (inc n))))
@dexterous
dexterous / devops-maturity.md
Last active June 4, 2021 04:41
Article text from "Is DevOps Falling into the Maturity Trap?"

@DevOpsSummit #CloudNative #Serverless #DevOps

BY JASON BLOOMBERG

APRIL 29, 2018 07:00 PM EDT

Guest post by Intellyx Principal Analyst Charles Araujo

I was at a conference recently when I saw it. I sighed and shook my head.

@dexterous
dexterous / ArtIsNotAboutYou.md
Created April 16, 2021 14:20 — forked from Madrox/ArtIsNotAboutYou.md
Art is Not About You

Art is Not About You

Forked from a community statement about Clojure

The only people entitled to say how art 'ought' to work are people who make art, and the scope of their entitlement extends only to their own art.

Just because someone creates something does not imply they owe the world a change in their status, focus and effort, e.g. from artist to community manager.

As an appreciator of a piece of art you are not thereby entitled to anything at all. You are not entitled to a say in how it evolves. You are not entitled to timely updates. You are not entitled to the attention of the artist. You are not entitled to having value attached to your complaints. You are not entitled to this explanation.

(->> (System/getProperties)
(filter #(clojure.string/ends-with? (key %) ".path"))
(map #(clojure.string/join "\n\t" (cons (key %) (clojure.string/split (val %) (re-pattern java.io.File/pathSeparator)))))
(clojure.string/join "\n\n")
(println))
#!/bin/bash -e
if [[ -n "$DEBUG" ]]; then
set -x
PS4='+ [ $(date +%T) ] '
fi
if [[ -f ./main.exe && ./main.exe -ot ./main.cs ]]; then
echo -n "Compiled binary outdated; removing... "
@dexterous
dexterous / vimium-options.json
Last active July 23, 2024 02:10
Tool Settings
{
"searchEngines": "image: https://www.google.com/search?q=%s&tbm=isch Google Image\nwiki: http://www.wikipedia.org/w/index.php?title=Special:Search&search=%s Wikipedia\nyt: http://www.youtube.com/results?search_query=%s Youtube\npocket: https://getpocket.com/saves/search?query=%s Pocket\n\n# More examples.\n#\n# (Vimium supports search completion Wikipedia, as\n# above, and for these.)\n#\n# g: http://www.google.com/search?q=%s Google\n# l: http://www.google.com/search?q=%s&btnI I'm feeling lucky...\n# gm: https://www.google.com/maps?q=%s Google maps\n# b: https://www.bing.com/search?q=%s Bing\n# d: https://duckduckgo.com/?q=%s DuckDuckGo\n# az: http://www.amazon.com/s/?field-keywords=%s Amazon\n# qw: https://www.qwant.com/?q=%s Qwant",
"settingsVersion": "2.1.2",
"userDefinedLinkHintCss": "div > .vimiumHintMarker {\n /* linkhint boxes */\n background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#FFF785), color-stop(100%,#FFC542));\n border: 1px solid #E3BE23;\n}\n\ndiv > .vimiumHi
@dexterous
dexterous / move_from_dead_letter.py
Last active January 13, 2024 09:14
Some people just don't get how to do concurrency/parallelism right. (sigh!)
import boto3
import sys
import Queue
import threading
work_queue = Queue.Queue()
sqs = boto3.resource('sqs')
from_q_name = sys.argv[1]