Skip to content

Instantly share code, notes, and snippets.

@NZSmartie
NZSmartie / esp-env.sh
Created October 3, 2018 22:02
Sets up your IDF_PATH and PATH for use with ESP32 development. also provides `deactivate` function to cleanup
#!/bin/bash
_PRE_IDF_PATH=$PATH
_PRE_IDF_PS1=$PS1
_PWD=$(dirname $(realpath $BASH_SOURCE))
export PATH=$PATH:$_PWD/xtensa-esp32-elf/bin
export IDF_PATH=$_PWD/esp-idf
@NZSmartie
NZSmartie / winrm-test.py
Created October 5, 2018 02:16
Test WinRM command from a python2 script
#! /usr/bin/env python2
from __future__ import print_function
import getpass
from winrm.protocol import Protocol
conn = Protocol(
endpoint='https://dc.example.com:5986/wsman',
@NZSmartie
NZSmartie / git-ps1-snippit.bashrc
Created October 5, 2018 02:22
PS1 with __git_ps1
if [ "$color_prompt" = yes ]; then
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\[\033[38;5;9m\]$(__git_ps1 " [%s]")\[\033[00m\]\n\$ '
else
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w$(__git_ps1 " [%s]")\n\$ '
fi
@NZSmartie
NZSmartie / starmade-mod-proposal.md
Created April 7, 2019 01:13
StarMade Modding proposal with StarMade Dock integration.

Mod Proposal

Goals

  • Lay foundation to protect players against malicious/unwanted mods that may degrade game experience.
    • By allowing 3rd party mods to run on player's PCs, we're literary offering Remote Code Execution As A Service.
  • Minimise effort for players to join servers using mods.
  • Provide clear documentation with simple processes for creating, developing, uploading and using mods.

Glossary

@NZSmartie
NZSmartie / ec2.sh
Created September 5, 2019 19:06
ec2 inventory bootstrap for ansbile
#!/bin/bash
set -e
# Discover the current version of ansible
ANSILBE_VERSION=$(ansible --version | sed -rn 's/.*ansible ([0-9.]+).*/\1/p')
# If 'region = auto' is set in ec2.ini, then we need to export the region from the local aws configutation
export AWS_DEFAULT_REGION=$(aws configure get region)
@NZSmartie
NZSmartie / drop_stream.rs
Last active April 26, 2021 01:22
Pass a callback into a Stream that will be called when the Stream is dropped
use ::pin_project::{pin_project, pinned_drop};
use futures::{stream::Fuse, StreamExt};
use std::pin::Pin;
#[pin_project(PinnedDrop)]
pub struct DropStream<St, Item, C>
where
St: futures::Stream<Item = Item>,
C: FnMut(),
{