This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #~/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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "crypto/rand" | |
| "crypto/subtle" | |
| "encoding/base64" | |
| "errors" | |
| "fmt" | |
| "log" | |
| "strings" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| version: '3' | |
| networks: | |
| mynetwork: | |
| ipam: | |
| config: | |
| - subnet: 172.20.0.0/24 | |
| services: | |
| nodered1: | |
| image: nodered/node-red-docker | |
| ports: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| "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"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| query IntrospectionQuery { | |
| __schema { | |
| queryType { name } | |
| mutationType { name } | |
| subscriptionType { name } | |
| types { | |
| ...FullType | |
| } | |
| directives { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ## 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 |
NewerOlder