Skip to content

Instantly share code, notes, and snippets.

@erichiller
erichiller / dotnet-suggest-shim.ps1
Last active November 27, 2023 14:03
Bash Completions should go into `~/.bash_completion`
# dotnet suggest shell start
#$env:PATH+=":~/.dotnet/tools";
if (Get-Command "dotnet-suggest" -errorAction SilentlyContinue)
{
$availableToComplete = (dotnet-suggest list) | Out-String
$availableToCompleteArray = $availableToComplete.Split([Environment]::NewLine, [System.StringSplitOptions]::RemoveEmptyEntries) | Where-Object { $_ -ne "dotnet" }
Register-ArgumentCompleter -Native -CommandName $availableToCompleteArray -ScriptBlock {
param($wordToComplete, $commandAst, $cursorPosition)
$fullpath = (Get-Command $commandAst.CommandElements[0]).Source
@grenzi
grenzi / Set-PsEnv.psm1
Last active February 21, 2023 23:11
sets powershell environment variables from python-dotenv formatted .env file
<#
.Synopsis
Exports environment variable from the .env file to the current process.
.Description
This function looks for .env file in the current directoty, if present
it loads the environment variable mentioned in the file to the current process.
based on https://github.com/rajivharris/Set-PsEnv
@ubergesundheit
ubergesundheit / readme.md
Last active June 24, 2024 06:57
systemd traefik.service

systemd Service Unit for Traefik

Adapted from caddy systemd Service Unit

The provided file should work with systemd version 219 or later. It might work with earlier versions. The easiest way to check your systemd version is to run systemctl --version.

Instructions

We will assume the following:

# ERIC - EDH - setup bash
# If not running interactively, don't do anything
# this keeps SCP (file transfer from throwing errors) -- stops here
case $- in
*i*) ;;
*) return;;
esac
# Prevent Loops
@erichiller
erichiller / profile.ps1
Last active March 10, 2024 11:39
powershell profile for cmder - revised to load module information from json file via jq.exe
# Stored here:
# https://gist.github.com/erichiller/ee1ad352f8a2dd97a1ed606faa43f87f
# Set the cursor to be at the end of the line when searching history. ie. ^ Up arrow
Set-PSReadLineOption -HistorySearchCursorMovesToEnd
# Change character prefix for multiline commands
Set-PSReadLineOption -ContinuationPrompt ' '
# see possible options under "Tab Complete" here:
@danijar
danijar / blog_tensorflow_sequence_labelling.py
Last active January 12, 2024 15:18
TensorFlow Sequence Labelling
# Example for my blog post at:
# http://danijar.com/introduction-to-recurrent-networks-in-tensorflow/
import functools
import sets
import tensorflow as tf
def lazy_property(function):
attribute = '_' + function.__name__
@revolunet
revolunet / lzw_encoder.js
Created February 25, 2011 14:55
LZW javascript compress/decompress
// LZW-compress a string
function lzw_encode(s) {
var dict = {};
var data = (s + "").split("");
var out = [];
var currChar;
var phrase = data[0];
var code = 256;
for (var i=1; i<data.length; i++) {
currChar=data[i];