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 python | |
| ## Mysql-Python basic examples. | |
| ## All code is taken from [here](http://zetcode.com/databases/mysqlpythontutorial/) | |
| ## Gist created only for quick reference purpose | |
| import sys | |
| import _mysql | |
| import MySQLdb as mdb |
| #!/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 ... ] |
| import sys | |
| from urllib import urlencode | |
| import requests | |
| from urlparse import urlparse, parse_qs | |
| from random import choice | |
| import re | |
| self_id = None # your facebook id here | |
| utc_bday = None # utc timestamp of your birthday |
| [ | |
| { | |
| "symbol": "Lek", | |
| "code": "ALL", | |
| "uhex": [ | |
| "4c", | |
| "65", | |
| "6b" | |
| ], | |
| "name": "Albania Lek" |
| ## Update! Found an alternative approach that's concise and feels much more idiomatic | |
| def compose (f, g): | |
| return lambda x: f(g(x)) | |
| def comp(*args): | |
| return reduce(compose, args[1:], args[0]) | |
| def comp1(*args): |
| #!/bin/bash | |
| ## This shell script will read all names from repos.txt | |
| ## which are names of git repositories located at | |
| ## git@main-reposerver:/path/to/repos | |
| ## if a mirror is not created, it will create | |
| ## | |
| ## other wise it will try to update the mirror | |
| ## | |
| ## Main purpose of having mirrors is backup so pushing |
| (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 |
| from twython import Twython | |
| ## Defining access_token as a function so that the token may be cached | |
| ## using a decorator as follows, | |
| ## | |
| ## get_access_token = cache_textfile('.twython-token')(access_token) | |
| ## | |
| def access_token(auth_client): | |
| return auth_client.obtain_access_token() |
| class ChatLocaleMiddleware(object): | |
| def process_request(self, request): | |
| if request.path in ['/jsi18n/']: | |
| return None | |
| match = SHOPPER_CHAT_PATH.match(request.path) | |
| if match is not None: | |
| appid = match.groups()[0] | |
| try: | |
| store = Store.objects.get(appid=appid) |