Skip to content

Instantly share code, notes, and snippets.

@agbaraka
agbaraka / docker_remote.go
Created September 14, 2019 08:21
Access remote docker daemon via ssh using Golang Docker SDK
package main
import (
"context"
"fmt"
"github.com/docker/cli/cli/connhelper"
"github.com/docker/docker/api/types"
"github.com/docker/docker/client"
"net/http"
"os"
@m-radzikowski
m-radzikowski / script-template.sh
Last active April 25, 2024 18:43
Minimal safe Bash script template - see the article with full description: https://betterdev.blog/minimal-safe-bash-script-template/
#!/usr/bin/env bash
set -Eeuo pipefail
trap cleanup SIGINT SIGTERM ERR EXIT
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P)
usage() {
cat <<EOF
Usage: $(basename "${BASH_SOURCE[0]}") [-h] [-v] [-f] -p param_value arg1 [arg2...]
@Fusl
Fusl / gist:3a708b8c32c9d5264fa0
Last active April 25, 2024 18:43
Streaming audio output from Linux (Pulseaudio) to Windows
# Windows (receiver) side:
.\ffplay.exe -nodisp -ac 2 -acodec pcm_u8 -ar 48000 -analyzeduration 0 -probesize 32 -f u8 -i udp://0.0.0.0:18181?listen=1
# Linux (transmitter) side:
pactl load-module module-null-sink sink_name=remote
ffmpeg -f pulse -i "remote.monitor" -ac 2 -acodec pcm_u8 -ar 48000 -f u8 "udp://RECEIVER:18181"
pavucontrol # Change the default output to the Null sink or move single applications to this "output" device.
@AndrewPla
AndrewPla / Iterate Over PSCustomObject Properties Example.ps1
Created January 6, 2019 19:21
iterate through all properties on a pscustomobject. This is example code to accompany a blogpost.
# Create a pscustomobject from a hashtable
$object = [pscustomobject]@{ Key1 = 'Val1' ; Key2 = 'Val2' }
# Grab all noteproperty members
$objMembers = $object.psobject.Members | where-object membertype -like 'noteproperty'
foreach ($member in $objMembers) {
# Now you can do what you want with the name and value.
$Member.name
$Member.Value
@dvmatyun
dvmatyun / animated_list_aim.dart
Created April 25, 2024 14:10
Example for animated list with tracking it's entities changes
import 'package:flutter/material.dart';
import 'listanable_repo.dart';
extension IterableExtensions<T> on Iterable<T> {
T? firstWhereOrNull(bool Function(T element) test) {
for (final element in this) {
if (test(element)) return element;
}
return null;
}
@qoomon
qoomon / conventional_commit_messages.md
Last active April 25, 2024 18:36
Conventional Commit Messages

Conventional Commit Messages

See how a minor change to your commit message style can make a difference.

Tip

Have a look at git-conventional-commits , a CLI util to ensure these conventions and generate verion and changelogs

Commit Message Formats

Default

@bistory
bistory / Klipper Anycubic i3 Mega
Last active April 25, 2024 18:34
Anycubic i3 Mega configuration for Klipper (with TMC2209 + SPI, BMG extruder with stock motor, pressure advance and BLTouch clone)
# This file contains pin mappings for the Anycubic i3 Mega with
# Ultrabase from 2017. (This config may work on an Anycubic i3 Mega v1
# prior to the Ultrabase if you comment out the definition of the
# endstop_pin in the stepper_z1 section.) To use this config, the
# firmware should be compiled for the AVR atmega2560.
# See the example.cfg file for a description of available parameters.
[stepper_x]
step_pin: PF0
@RebeccaWhit3
RebeccaWhit3 / Complete List of Environment Variables in Windows 10.md
Last active April 25, 2024 18:33
Complete List of Environment Variables in Windows 10

Full List of Environment Variables in Windows 10

![information][6] Information

[Environment variables][7] are a set of dynamic named values that can affect the way running processes will behave on a computer. The variables can be used both in scripts and on the command line. Environment variables makes it easy when certain standard directories and parameters need to be referenced but where the actual locations or names can vary from computer to computer.

This tutorial will show you a complete list of environment variables that can be used to reference standard directories and parameters in Windows 10.

![Note][8] Note

@mauler
mauler / http_server_auth.py
Last active April 25, 2024 18:33 — forked from fxsjy/SimpleAuthServer.py
Python3 http.server supporting basic HTTP Auth (username/password)
# Extended python -m http.serve with --username and --password parameters for
# basic auth, based on https://gist.github.com/fxsjy/5465353
from functools import partial
from http.server import SimpleHTTPRequestHandler, test
import base64
import os
class AuthHTTPRequestHandler(SimpleHTTPRequestHandler):