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 May 9, 2023 21:21
Tool Settings
{
"settingsVersion": "1.67.4",
"exclusionRules": [
{
"pattern": "https?://(mail|calendar|keep|photos|groups|drive|meet|chat|messages).google.com/*",
"passKeys": ""
},
{
"pattern": "https?://(mobile.)?twitter.com/*",
"passKeys": ""
@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]