Skip to content

Instantly share code, notes, and snippets.

@charlmert
charlmert / debian_install_older_chrome.sh
Last active April 13, 2024 07:05
Script to download and install older versions of google chrome. -l to list numbers and then -d number example -d8 to download 89.0.4389.114-1
#~/bin/bash
usage() { echo "Usage: $0 [-d <number>] [-l]" 1>&2; exit 1; }
while getopts ":d:" o; do
case "${o}" in
d)
d=${OPTARG}
;;
esac
@alexedwards
alexedwards / main.go
Last active August 6, 2025 03:32
Password hashing and verification with Argon2id
package main
import (
"crypto/rand"
"crypto/subtle"
"encoding/base64"
"errors"
"fmt"
"log"
"strings"
@natcl
natcl / docker-compose.yaml
Created September 26, 2018 14:31
docker-compose static IP example
version: '3'
networks:
mynetwork:
ipam:
config:
- subnet: 172.20.0.0/24
services:
nodered1:
image: nodered/node-red-docker
ports:
@valer-cara
valer-cara / multi-broker-tunnel.sh
Created July 31, 2018 13:10
Kafka on kubernetes: portforward & dnat to all brokers for remote access
#!/bin/bash
# This is a bit hardcoded, but it's meant as a proof of concept.
# used in kubectl get pods when targeting kafka broker pods
KARGS="-n kafka -l release=kafka,app=kafka"
# used in kubectl port-forward (setting the namespace, can be omitted)
KPORTFWD_ARGS="-n kafka"
# port on broker pods to forward
DPORT=9092
@sbycrosz
sbycrosz / SimpleReducer_LoadingReducer.js
Last active May 4, 2020 14:24
SimpleReducer_LoadingReducer.js
// api/loadingReducer.js
const loadingReducer = (state = {}, action) => {
const { type } = action;
const matches = /(.*)_(REQUEST|SUCCESS|FAILURE)/.exec(type);
// not a *_REQUEST / *_SUCCESS / *_FAILURE actions, so we ignore them
if (!matches) return state;
const [, requestName, requestState] = matches;
@pmdevita
pmdevita / ffmpeg-pyaudio.py
Last active June 1, 2025 08:44
Play an audio file using FFMPEG, PortAudio, and Python
# FFMPEG example of Blocking Mode Audio I/O https://people.csail.mit.edu/hubert/pyaudio/docs/
"""PyAudio Example: Play a wave file."""
import pyaudio
import wave
import sys
import subprocess
CHUNK = 1024
@mdonkers
mdonkers / server.py
Last active January 21, 2026 14:23
Simple Python 3 HTTP server for logging all GET and POST requests
#!/usr/bin/env python3
"""
License: MIT License
Copyright (c) 2023 Miel Donkers
Very simple HTTP server in python for logging requests
Usage::
./server.py [<port>]
"""
from http.server import BaseHTTPRequestHandler, HTTPServer
@brendtumi
brendtumi / Diffie-Hellman.js
Created July 29, 2016 12:37
[nodejs][javascript] Diffie-Hellman key exchange - nodejs v6
"use strict";
const assert = require("assert");
const crypto = require("crypto");
let server = crypto.createDiffieHellman(1024);
let prime = server.getPrime();
console.log("Generate Alice's keys...");
let alice = crypto.createDiffieHellman(prime);
let alicePublicKey = alice.generateKeys("base64");
@craigbeck
craigbeck / introspection-query.graphql
Created April 6, 2016 20:20
Introspection query for GraphQL
query IntrospectionQuery {
__schema {
queryType { name }
mutationType { name }
subscriptionType { name }
types {
...FullType
}
directives {
@cmatskas
cmatskas / GitDeleteCommands.ps1
Last active September 22, 2022 07:59
Git Delete Branch commands
## Delete a remote branch
$ git push origin --delete <branch> # Git version 1.7.0 or newer
$ git push origin :<branch> # Git versions older than 1.7.0
## Delete a local branch
$ git branch --delete <branch>
$ git branch -d <branch> # Shorter version
$ git branch -D <branch> # Force delete un-merged branches
## Delete a local remote-tracking branch