This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as https from 'https'; | |
import * as AWS from 'aws-sdk'; | |
import { execFileSync } from 'child_process'; | |
import * as process from 'process'; | |
const REGION = process.env.AWS_REGION || 'us-east-1'; | |
const { CREDENTIALS_PROCESS } = process.env; | |
export const createDefaultConfiguration = async (): Promise<AWS.S3.ClientConfiguration> => { | |
const config = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; https://blog.jonm.dev/posts/rsa-public-key-cryptography-in-java/ | |
;; generate a 2048-bit RSA private key | |
;; $ openssl genrsa -out private_key.pem 2048 | |
;; # convert private Key to PKCS#8 format (so Java can read it) | |
;; $ openssl pkcs8 -topk8 -inform PEM -outform DER -in private_key.pem \ | |
;; -out private_key.der -nocrypt | |
;; # output public key portion in DER format (so Java can read it) | |
;; $ openssl rsa -in private_key.pem -pubout -outform DER -out public_key.der |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(:import java.nio.charset.Charset | |
java.security.MessageDigest | |
javax.xml.bind.DatatypeConverter) | |
(defn get-sha [s] | |
(DatatypeConverter/printHexBinary | |
(.digest (MessageDigest/getInstance "SHA-1") (.getBytes s "UTF-8")))) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(:import java.io.ByteArrayInputStream | |
java.io.ByteArrayOutputStream | |
java.io.OutputStream | |
java.util.zip.GZIPInputStream | |
java.util.zip.GZIPOutputStream | |
java.nio.charset.Charset) | |
(defn compress ^bytes [^String s] | |
(.toByteArray | |
(with-open [*output (ByteArrayOutputStream.) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import tornado.web | |
from tornado import gen | |
from tornado.locks import Lock | |
class Service(): | |
def __init__(self, service_id, nth=None): | |
self._nth = nth | |
self._service_id = service_id | |
self._count = 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; remove keys with nil value from a data structure created by parsing an xml file with clojure.xml | |
;; to do this you first must convert the clojure.xml elements to regular maps since they are created | |
;; as structs and thus will not allow you to remove keys | |
(require '[com.rpl.specter :as r] '[clojure.xml :as xml]) | |
(def ALL-ELEMENTS | |
(r/recursive-path | |
[] p | |
(r/if-path :content |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# never use pull https://www.reddit.com/r/programming/comments/6nzgje/psa_use_git_config_global_bool_pullrebase_true_to/ | |
git fetch | |
git log ..@{u} # show me the new goodies | |
# @{u} is git-speak for "the upstream branch I'm currently tracking" | |
# Let's take it | |
git rebase | |
# alternatively |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Set environment variables here so they are available globally to all apps | |
# (and Terminal), including those launched via Spotlight. | |
# | |
# After editing this file run the following command from the terminal to update | |
# environment variables globally without needing to reboot. | |
# NOTE: You will still need to restart the relevant application (including | |
# Terminal) to pick up the changes! | |
# grep -E "^setenv" /etc/launchd.conf | xargs -t -L 1 launchctl | |
# | |
# See http://www.digitaledgesw.com/node/31 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://github.com/arnaudbenard/redux-mock-store/issues/59#issuecomment-345741265 | |
//------------- the saga ---------------- | |
function* fetchSaga(action) { | |
try { | |
yield put({type: "FETCH_SUCCEEDED", data: "data"}); | |
} catch (e) { | |
yield put({type: "FETCH_FAILED", message: e.message}); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:%s/\(-\)\(\w\)/\u\2/g | |
:%s <- every line in file | |
/ | |
\(-\) <- match group of char "-" | |
\(\w\) <- match group of any char | |
/ | |
\u\2 <- uppercase group 2 | |
/ | |
g <- globally (all occurances per line) |
NewerOlder