Skip to content

Instantly share code, notes, and snippets.

View artemdevel's full-sized avatar
😎
Coding

Artem artemdevel

😎
Coding
View GitHub Profile
@artemdevel
artemdevel / mount_aws_nvme_ephemeral.sh
Created August 9, 2021 15:17 — forked from fideloper/mount_aws_nvme_ephemeral.sh
Find, format, and mount an AWS Ephemeral NVMe disk within ec2 in user data
#!/usr/bin/env bash
###
## This mounts a (single) ephemral NVMe drive in an EC2 server.
## It's meant to be run once, within user-data
## For EBS drives (non-ephemeral storage), see: https://gist.github.com/jalaziz/c22c8464cb602bc2b8d0a339b013a9c4
#
@artemdevel
artemdevel / atomic.py
Created May 25, 2020 13:46
Python atomic counter
import threading
class AtomicCounter(object):
"""An atomic, thread-safe counter"""
def __init__(self, initial=0):
"""Initialize a new atomic counter to given initial value"""
self._value = initial
self._lock = threading.Lock()
@artemdevel
artemdevel / infra-secret-management-overview.md
Created May 20, 2020 20:20 — forked from maxvt/infra-secret-management-overview.md
Infrastructure Secret Management Software Overview

Currently, there is an explosion of tools that aim to manage secrets for automated, cloud native infrastructure management. Daniel Somerfield did some work classifying the various approaches, but (as far as I know) no one has made a recent effort to summarize the various tools.

This is an attempt to give a quick overview of what can be found out there. The list is alphabetical. There will be tools that are missing, and some of the facts might be wrong--I welcome your corrections. For the purpose, I can be reached via @maxvt on Twitter, or just leave me a comment here.

There is a companion feature matrix of various tools. Comments are welcome in the same manner.

@artemdevel
artemdevel / ex.sh
Created March 8, 2020 19:24
Extract various archives
#!/usr/bin/env bash
if [ -f $1 ] ; then
case $1 in
*.tar.bz2) tar xjf $1 ;;
*.tar.gz) tar xzf $1 ;;
*.bz2) bunzip2 $1 ;;
*.rar) unrar x $1 ;;
*.gz) gunzip $1 ;;
*.tar) tar xf $1 ;;
@artemdevel
artemdevel / http_server.js
Created October 27, 2019 13:33
Simple HTTP server on JS
// Simple HTTP server
const http = require('http');
const data = {'message': 'Hello World'};
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'application/json'});
res.end(JSON.stringify(data));
}).listen(1800);
#!/usr/bin/env python
"""
Simple WebSocket client.
"""
import sys
import asyncio
import websockets
# The official echo server
@artemdevel
artemdevel / script.sh
Last active October 5, 2023 13:32
Build Cpp Core Guidelines PDF
#!/usr/bin/env bash
# NOTE: I haven't tested this script myself. At least I know that command line parameters for Pandoc has changed.
# https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md
wget -N https://raw.githubusercontent.com/isocpp/CppCoreGuidelines/master/CppCoreGuidelines.md
wget -N https://raw.githubusercontent.com/isocpp/CppCoreGuidelines/master/param-passing-advanced.png
wget -N https://raw.githubusercontent.com/isocpp/CppCoreGuidelines/master/param-passing-normal.png
# https://github.com/isocpp/CppCoreGuidelines/issues/23
@artemdevel
artemdevel / Dockerfile
Last active October 19, 2017 04:54
Java REPL Dockerfile
FROM openjdk:8-jdk-alpine
ARG JAVA_REPL_VERSION=VERSION_NOT_SET
WORKDIR javarepl
ADD https://github.com/albertlatacz/java-repl/releases/download/$JAVA_REPL_VERSION/javarepl-$JAVA_REPL_VERSION.jar javarepl/javarepl.jar
CMD ["java", "-jar", "javarepl/javarepl.jar"]
#!/usr/bin/env bash
echo ">>> Installing Mailhog"
# Download binary from github
wget --quiet -O ~/mailhog https://github.com/mailhog/MailHog/releases/download/v0.2.1/MailHog_linux_amd64
# Make it executable
chmod +x ~/mailhog
@artemdevel
artemdevel / gist:9edfcb387531ecbf6ba770946235519d
Last active April 24, 2017 10:22
Android 6.0.1 (Build M4B30X) Root for Nexus 5
# Download latest Android image, "hammerhead" for Nexus 5 (GSM/LTE)
https://developers.google.com/android/nexus/images#hammerhead
# Download latest TWRP
https://dl.twrp.me/hammerhead/
# Download latest SuperSu
https://download.chainfire.eu/supersu
Enable USB debugging.