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
;; | |
;; mlib: run proccessing loop in separate thread | |
;; | |
(ns mlib.thread | |
(:require | |
[clojure.core.async :refer [thread <!!]])) | |
; | |
(defn- thread-loop [state' init step cleanup] |
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
/** | |
openssl req -newkey rsa:2048 -nodes -batch -utf8 -keyout keytemp.pem -x509 -days 365 -out cert.pem \ | |
-subj "/C=GB/ST=London/L=London/O=Global Security/OU=IT Department/CN=example.com" | |
openssl rsa -in keytemp.pem -out key.pem | |
*/ | |
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
node -e "console.log(require('crypto').randomBytes(20).toString('hex'))" |
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
openssl req -utf8 -sha256 -out ${NAME}.csr -new -newkey rsa:2048 -nodes -keyout ${NAME}.key | |
https://www.openssl.org/docs/man1.0.2/apps/openssl-req.html | |
openssl req -nodes -newkey rsa:2048 -keyout example.key -out example.csr \ | |
-subj "/C=GB/ST=London/L=London/O=Global Security/OU=IT Department/CN=example.com" \ | |
-batch -utf8 | |
-config "file" |
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://hackernoon.com/graceful-shutdown-in-nodejs-2f8f59d1c357 | |
// | |
const express = require('express'); | |
const mongoose = require('mongoose'); | |
const app = express(); | |
app.use(express.urlencoded({extended: true})); | |
app.use(express.json()); |
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
start-socks: | |
ssh -NCD 9999 -qf your.not-blocked.host | |
--- | |
.ssh/config: | |
Host bitbucket.org | |
ProxyCommand=nc -X 5 -x localhost:9999 %h %p |
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
#!/bin/sh | |
# https://medium.com/@cjus/handy-docker-aliases-4bd85089a3b8 | |
alias dm='docker-machine' | |
alias dmx='docker-machine ssh' | |
alias dk='docker' | |
alias dki='docker images' | |
alias dks='docker service' | |
alias dkrm='docker rm' |
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
let addrs = new Set() | |
// avoid while(true) {} loops | |
for(let bi = getReasonalbeStartingBlockIndex(); bi > 0; bi--) { | |
let block = await web3.eth.getBlock(bi) | |
if(stopCondition(block)) { | |
// block.timestamp < START_TIME | |
break; | |
} |
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
# | |
# maxp.dev: generic .gitignore | |
# | |
## no hiddens in scm | |
.* | |
## editor backups | |
*~ | |
*.bak |
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
type MyTime struct { | |
time.Time | |
} | |
func (self *MyTime) UnmarshalJSON(b []byte) (err error) { | |
s := string(b) | |
// Get rid of the quotes "" around the value. | |
// A second option would be to include them | |
// in the date format string instead, like so below: |