Skip to content

Instantly share code, notes, and snippets.

View ademidoff's full-sized avatar
🎯
Focusing

Alex Demidoff ademidoff

🎯
Focusing
View GitHub Profile
### Keybase proof
I hereby claim:
* I am ademidoff on github.
* I am ademidoff (https://keybase.io/ademidoff) on keybase.
* I have a public key whose fingerprint is 30AB 3CC3 F763 49F7 E109 0A2F 5490 45C1 8579 B0EE
To claim this, I am signing this object:
@ademidoff
ademidoff / docker-tags.sh
Created December 14, 2023 15:43
List Docker Image Tags
#!/usr/bin/env bash
# Gets all tags for a given docker image.
# Examples:
# retrieve all tags for a single library
# docker-tags "library/redis"
@ademidoff
ademidoff / purge-ami-images
Created December 26, 2022 12:59
Purge AMI images and their snapshots
# get a list of AMI Images in a region
aws ec2 describe-images --owners self --filters "Name=tag:name,Values=PMM2 Server*" --region us-east-1 --output json | jq '.Images' > ~/IMAGES.json
# save just AMI IDs and their snapshot IDs
jq -r '.[] | .ImageId + " " + .BlockDeviceMappings[1].Ebs.SnapshotId' IMAGES.json > IMAGES_AND_SNAPSHOTS.txt
# first deregister the image
for AMI_ID in $(cat IMAGES_AND_SNAPSHOTS.txt); do
if [[ "$AMI_ID" =~ snap-* ]]; then
continue
@ademidoff
ademidoff / index.html
Created April 29, 2022 00:45
Minimalist Thermostat
<div class="t">
<div class="t__inner">
<div class="t__value">
<span class="t__digit" data-temp>-</span><span class="t__digit" data-temp>-</span><span class="t__degree">°</span>
</div>
<button class="t__drag" type="button" data-drag>
<span class="t__sr" data-temp-sr>--</span>
</button>
<svg class="t__arrows" width="256px" height="256px" viewBox="0 0 256 256">
<g fill="none" stroke="currentColor" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" opacity="0.2">
@ademidoff
ademidoff / .bash_aliases
Last active August 2, 2021 11:08
My bash aliases
alias ..="cd .."
alias ...="cd ../.."
alias ll="ls -lah"
alias cls="clear"
# docker aliases
alias dps="docker ps -a"
alias dstop="docker stop"
alias dstart="docker start"
alias dpull='docker pull'
# EditorConfig is awesome: https://EditorConfig.org
# top-most EditorConfig file
root = true
# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true
function drawMouseSpeedDemo() {
var mrefreshinterval = 500; // update display every 500ms
var lastmousex=-1;
var lastmousey=-1;
var lastmousetime;
var mousetravel = 0;
var mpoints = [];
var mpoints_max = 30;
$('html').mousemove(function(e) {
var mousex = e.pageX;
@ademidoff
ademidoff / png.inject.js
Created April 16, 2018 13:19 — forked from lahmatiy/png.inject.js
Solution to inject/fetch a custom data to/from a PNG image
const pngSignature = Buffer.from([137, 80, 78, 71, 13, 10, 26, 10]);
const hashKey = 'react-snapshot-hash';
const crcTable = [];
const initialCrc = 0xffffffff;
for (let n = 0; n < 256; n++) {
let c = n;
for (let k = 0; k < 8; k++) {
if (c & 1) {
@ademidoff
ademidoff / boston.json
Created March 24, 2018 09:36 — forked from pprett/boston.json
Decision Tree Viewer (D3 and Sklearn)
{"error": 42716.2954, "samples": 506, "value": [22.532806324110698], "label": "RM <= 6.94", "type": "split", "children": [{"error": 17317.3210, "samples": 430, "value": [19.93372093023257], "label": "LSTAT <= 14.40", "type": "split", "children": [{"error": 6632.2175, "samples": 255, "value": [23.349803921568636], "label": "DIS <= 1.38", "type": "split", "children": [{"error": 390.7280, "samples": 5, "value": [45.58], "label": "CRIM <= 10.59", "type": "split", "children": [{"error": 0.0000, "samples": 4, "value": [50.0], "label": "Leaf - 4", "type": "leaf"}, {"error": 0.0000, "samples": 1, "value": [27.9], "label": "Leaf - 5", "type": "leaf"}]}, {"error": 3721.1632, "samples": 250, "value": [22.90520000000001], "label": "RM <= 6.54", "type": "split", "children": [{"error": 1636.0675, "samples": 195, "value": [21.629743589743576], "label": "LSTAT <= 7.57", "type": "split", "children": [{"error": 129.6307, "samples": 43, "value": [23.969767441860473], "label": "TAX <= 222.50", "type": "split", "children": [{"err
@ademidoff
ademidoff / javascript_loader.js
Last active August 1, 2017 23:21 — forked from hagenburger/javascript_loader.js
Dynamically load JavaScript files with callback when finished
// Examples:
JavaScript.load("/javascripts/something.js");
JavaScript.load("http://www.someawesomedomain.com/api.js", function() {
API.use(); // or whatever api.js provides ...
});
/** Tested with: