find . -name '.git' | xargs dirname | xargs -P 4 -n 1 -I % ./backup-stashes.sh % /tmp/stash-backupsMuch of the code is generated by Claude Sonnet 3.5. Exercise caution by going through it before executing.
| #!/usr/bin/env bash | |
| ## Script for searching for all references to a particular function in | |
| ## a clojure project (A crude implementation of "Find usage" | |
| ## functionality commonly found in IDEs such as Intellij) False | |
| ## positives are possible. | |
| ## | |
| ## Usage: | |
| ## | |
| ## $ clj-fn-usages NAMESPACE_QUALIFIED_FN [ paths ... ] |
| (ns inclojure-mocks) | |
| ;; IN/Clojure 2018 lightning talk :: 13/01/2018 | |
| ;; | |
| ;; Topic: Mocking code (mainly for writing tests) | |
| ;; | |
| ;; Will be covered: | |
| ;; | |
| ;; 1. Mocking code using circleci/bond library |
| #!/usr/bin/env bash | |
| set -e | |
| usage() | |
| { | |
| cat << EOF | |
| usage: $(basename $0) [ -c COMMIT -v VAULT_PASSWORD_FILE ] -f FILE | |
| To view the actual changes in ansible vault/secret files for a git commit. |
| from itertools import izip_longest | |
| def fnone(f, *xs): | |
| """Takes a function f, and returns a function that calls f, replacing | |
| a None first argument to f with the supplied value x. Higher arity | |
| versions can replace arguments in the second and third | |
| positions (y, z). Note that the function f can take any number of | |
| arguments, not just the one(s) being None-patched. | |
| """ |
| import time | |
| from functools import wraps | |
| def throttle_greedy(wait): | |
| def decorator(fn): | |
| state = {'last_call_at': None} | |
| @wraps(fn) | |
| def wrapper(*args, **kwargs): |
| (defn consume-until-timeout | |
| [ms ch f init & args] | |
| (let [tmt (timeout ms)] | |
| (go (loop [ret init] | |
| (if-let [v (first (alts! [ch tmt]))] | |
| (recur (apply f ret [v])) | |
| ret))))) | |
| (comment |
| import d | |
| x = 10 | |
| def f(n): | |
| return x + n | |
| print 'f(2) called directly in module a [a.x = 10]' | |
| print f(2) |
| ### Hands on R session by Harshad Saykhedkar from today's Machine | |
| ### learning workshop (Fifth elephant Mumbai run-up event) | |
| --- | |
| R version 3.1.0 (2014-04-10) -- "Spring Dance" | |
| Copyright (C) 2014 The R Foundation for Statistical Computing | |
| Platform: i686-pc-linux-gnu (32-bit) | |
| R is free software and comes with ABSOLUTELY NO WARRANTY. |
| -module(message_ring). | |
| -compile(export_all). | |
| -export([]). | |
| %% Problem Statement: Write a ring benchmark. Create N processes in a | |
| %% ring. Send a message round the ring M times so that a total of N * | |
| %% M messages get sent. Time how long this takes for different values | |
| %% of N and M. |