Skip to content

Instantly share code, notes, and snippets.

View MikeMitterer's full-sized avatar
🎯
Focusing

Mike Mitterer MikeMitterer

🎯
Focusing
View GitHub Profile
@pauldraper
pauldraper / install.sh
Last active May 11, 2021 15:40
Docker ECR credential helper
# A docker credential helper that automatically calls AWS CLI for docker push/pull.
cat <<EOF
grep -q 'dkr.ecr.[^.]\+.amazonaws.com' - || exit
aws --output text ecr get-authorization-token --query authorizationData[0].authorizationToken \
| base64 --decode \
| sed -e 's/:/", "Secret":"/' -e 's/^/{"Username":"/' -e 's/$/"}/'
EOF | sudo tee /usr/local/bin/docker-credential-ecr-login
sudo chmod +x /usr/local/bin/docker-credential-ecr-login
@LexVocoder
LexVocoder / json-helpers.ts
Last active April 13, 2022 02:06
Helpers for converting JSON to actual TypeScript classes
/***
Inspired by http://choly.ca/post/typescript-json/ , except this is only for parsing (not stringifying).
If you use this, I'd appreciate some credit and some feedback ... but neither are required.
Copyright license (Apache) is at the bottom.
NOTE THIS WILL PROBABLY NOT WORK if your uglifier changes constructor/class names. This is a pretty common thing, and it makes me sad.
The main problem this solves is that JSON.stringify returns plain old JS objects, not TS instances.
@abn
abn / keycloak-fetch-token-postman-pre-request.js
Created October 12, 2017 13:02
A postman pre-request script to fetch a valid token from Red Hat SSO (Keycloak) and set it to a template variable to use in request headers.
// modify these configurations to work with your environment
var server = "https://sso.example.com";
var realm = "realm";
var resource = "client";
var username = "username";
var password = "url encoded password";
var url = `${server}/auth/realms/${realm}/protocol/openid-connect/token`;
var data = `grant_type=password&client_id=${resource}&username=${username}&password=${password}`;
@konrad-kaminski
konrad-kaminski / CountDownLatch.kt
Last active July 14, 2022 23:50
CountDownLatch naive implementation
/*
* Copyright 2016-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@destan
destan / ParseRSAKeys.java
Last active March 29, 2024 10:43
Parse RSA public and private key pair from string in Java
import java.io.IOException;
import java.net.URISyntaxException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.security.KeyFactory;
import java.security.NoSuchAlgorithmException;
import java.security.PrivateKey;
import java.security.interfaces.RSAPublicKey;
import java.security.spec.InvalidKeySpecException;
import java.security.spec.PKCS8EncodedKeySpec;
@vadimtsushko
vadimtsushko / index.html
Created August 12, 2015 06:47
Textfieds do not work in MDL CustomDialogs
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="packages/mdl/assets/styles/material.min.css">
<link rel="stylesheet" href="styles.css">
</head>
<body class="mdl-upgrading">
<div class="loading">Loading...</div>
<div id="wrapper" class="mdl-shadow--2dp">
@reagent
reagent / .gitignore
Last active November 8, 2023 08:53
Curses Windowing Example
demo
*.swp
[skin]
description=Ajnasz Blue Theme. Midnight Commander skin from Ajnasz.
[Lines]
horiz=─
vert=│
lefttop=┌
righttop=┐
leftbottom=└
rightbottom=┘
@defunctzombie
defunctzombie / browser.md
Last active April 10, 2024 17:45
browser field spec for package.json