Skip to content

Instantly share code, notes, and snippets.

View elquimista's full-sized avatar
🏠
WFH

elquimista elquimista

🏠
WFH
  • Pittsburg, NH
View GitHub Profile
@elquimista
elquimista / yubikey-reset.sh
Created March 12, 2019 00:44 — forked from pkirkovsky/yubikey-reset.sh
Utility for resetting a Yubikey to factory defaults using gpg-connect-agent. This will wipe out any stored keys and reset PINs to default values.
gpg-connect-agent <<EOF
/hex
scd serialno
scd apdu 00 20 00 81 08 40 40 40 40 40 40 40 40
scd apdu 00 20 00 81 08 40 40 40 40 40 40 40 40
scd apdu 00 20 00 81 08 40 40 40 40 40 40 40 40
scd apdu 00 20 00 81 08 40 40 40 40 40 40 40 40
scd apdu 00 20 00 83 08 40 40 40 40 40 40 40 40
scd apdu 00 20 00 83 08 40 40 40 40 40 40 40 40
scd apdu 00 20 00 83 08 40 40 40 40 40 40 40 40
@elquimista
elquimista / gpg2qrcode.sh
Last active January 17, 2024 16:44 — forked from joostrijneveld/gpg2qrcodes.sh
Produce printable QR codes for persistent, tangible storage of GPG private keys and vice versa.
# Depends on:
# paperkey (jabberwocky.com/software/paperkey/)
# libqrencode (fukuchi.org/works/qrencode/)
# Producing the QR codes:
# Split into 16 codes to ensure the data per image is not too large.
# Or split into 3 codes for smaller keys (e.g., ed25519)
gpg --export-secret-key KEYIDGOESHERE | paperkey --output-type raw | base64 > temp
if [ "$(uname)" == "Darwin" ]; then
split -n 16 temp IMG
@elquimista
elquimista / docker-compose.yml
Created February 23, 2017 20:52
docker-compose.yml example
app:
build: .
command: ./docker-compose-command.sh
volumes:
- .:/code/vmware_ma
ports:
- 80:3000
links:
- postgres
stdin_open: true
@elquimista
elquimista / combinations.js
Created November 23, 2016 03:00
Calculate combinations count in Javascript (ES5)
function combinationsCount(m, n) {
if (m < n) {
return 0;
} else if (m === n || n === 0) {
return 1;
} else {
var c = 1, i;
for (i = n + 1; i <= m; i ++) {
c *= i;
}
@elquimista
elquimista / components.js
Created July 18, 2016 18:57
Smart Text React.js Component
window.SmartTextbox = React.createClass({
getInitialState() {
return {
closeButtonImageDataUrl: "data:image/svg+xml;utf8;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iaXNvLTg4NTktMSI/Pgo8IS0tIEdlbmVyYXRvcjogQWRvYmUgSWxsdXN0cmF0b3IgMTkuMC4wLCBTVkcgRXhwb3J0IFBsdWctSW4gLiBTVkcgVmVyc2lvbjogNi4wMCBCdWlsZCAwKSAgLS0+CjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiBpZD0iQ2FwYV8xIiB4PSIwcHgiIHk9IjBweCIgdmlld0JveD0iMCAwIDUwIDUwIiBzdHlsZT0iZW5hYmxlLWJhY2tncm91bmQ6bmV3IDAgMCA1MCA1MDsiIHhtbDpzcGFjZT0icHJlc2VydmUiIHdpZHRoPSI1MTJweCIgaGVpZ2h0PSI1MTJweCI+CjxjaXJjbGUgc3R5bGU9ImZpbGw6I0Q3NUE0QTsiIGN4PSIyNSIgY3k9IjI1IiByPSIyNSIvPgo8cG9seWxpbmUgc3R5bGU9ImZpbGw6bm9uZTtzdHJva2U6I0ZGRkZGRjtzdHJva2Utd2lkdGg6MjtzdHJva2UtbGluZWNhcDpyb3VuZDtzdHJva2UtbWl0ZXJsaW1pdDoxMDsiIHBvaW50cz0iMTYsMzQgMjUsMjUgMzQsMTYgICAiLz4KPHBvbHlsaW5lIHN0eWxlPSJmaWxsOm5vbmU7c3Ryb2tlOiNGRkZGRkY7c3Ryb2tlLXdpZHRoOjI7c3Ryb2tlLWxpbmVjYXA6cm91bmQ7c3Ryb2tlLW1pdGVybGltaXQ6MTA
SVGAnimatedTransformList.prototype.translate = function (x, y) {
var xForms = this.baseVal,
xFormTranslate = undefined,
transform = undefined;
for (var i = 0, n = xForms.numberOfItems; i < n; i ++) {
transform = xForms.getItem(i);
if (transform.type === SVGTransform.SVG_TRANSFORM_TRANSLATE) {
xFormTranslate = transform;
break;