Skip to content

Instantly share code, notes, and snippets.

View niko-dunixi's full-sized avatar
🦆
Quack Quack!!

Niko Dunixi niko-dunixi

🦆
Quack Quack!!
View GitHub Profile
@niko-dunixi
niko-dunixi / debug.go
Created March 15, 2024 16:51
Find unequal struct fields in golang
// Custom comparison function
func compareStructs(a, b interface{}) {
valA := reflect.ValueOf(a)
valB := reflect.ValueOf(b)
for i := 0; i < valA.NumField(); i++ {
fieldA := valA.Field(i)
fieldB := valB.Field(i)
if !reflect.DeepEqual(fieldA.Interface(), fieldB.Interface()) {
@niko-dunixi
niko-dunixi / quick-setup.sh
Last active May 31, 2023 01:23
setup the favdev trinity
#!/usr/bin/env bash
set -euxo pipefail
# Base system
sudo apt-get update
sudo apt-get upgrade -y
# Git
git config --global user.name 'Niko Dunixi [He/Him]'
git config --global user.email '1402178+niko-dunixi@users.noreply.github.com'
git config --global init.defaultBranch main
# GoLang
@niko-dunixi
niko-dunixi / readme.md
Created September 30, 2021 15:41
AWS Cli Snippets

Get Account ID

$ aws sts get-caller-identity --query Account --output text

Get Current IAM User ARN

$ aws sts get-caller-identity --query Arn --output text
@niko-dunixi
niko-dunixi / readme.md
Created July 12, 2021 22:37
Install Go Hugo one-liner

Install Go Hugo one-liner

$ go get --tags extended github.com/gohugoio/hugo
@niko-dunixi
niko-dunixi / install-godoc.md
Created July 12, 2021 22:35
Install Go Doc

Install Go Doc

$ go get -v -u golang.org/x/tools/cmd/godoc
@niko-dunixi
niko-dunixi / readme.md
Last active January 6, 2021 21:45
Personal/Public docker mirrors

TODO: make this generic

  1. If you haven't, create your mirror ECRs. Make sure they're public
  2. Open the Cloud9 IDE
  3. Run the commands below to pull the public images and push them up for our own personal reuse
$ docker pull golang:1.15
$ docker pull python:3
$ docker pull amazonlinux:latest
@niko-dunixi
niko-dunixi / README.md
Created December 3, 2020 03:44
Ubuntu install SHADERed

SHADERed Installation for Ubuntu

$ [ ! -d /opt/SHADERed ] || sudo rm -rf /opt/SHADERed
$ sudo apt-get install -y libsfml-dev
$ cd /tmp
$ zip_url="$(curl https://api.github.com/repos/dfranx/SHADERed/releases | jq '.[0].assets[] | select(.name | contains("Linux.zip")) | .browser_download_url' -r)"
$ curl -JL "${zip_url}" -o shadered-linux.zip
$ unzip shadered-linux.zip
$ sudo mv SHADERed /opt/SHADERed
@niko-dunixi
niko-dunixi / readme.md
Last active November 18, 2020 23:12
Download portion of YouTube video

We can't do this with youtube-dl alone, we can pair this with ffmpeg to acomplish this task though. We use youtube-dl and ffmpeg to resolve the URL of the video, and then tell ffmpeg to download the range itself.

So to take a sound byte from this podcast and use it to create my ringtone:

$ audio_url="$(youtube-dl --audio-format mp3 --get-url https://youtu.be/s8tJ-R28HX8 | grep mime=audio | head -n 1)"
$ ffmpeg -ss 02:00:02.10 -i "${audio_url}" -t 00:00:12 -c:a mp3 paul-ringtone.mp3
@niko-dunixi
niko-dunixi / install-docker.md
Last active November 9, 2020 02:51 — forked from zulhfreelancer/install-docker.md
Install Docker oneliner script

Install Docker

$ curl -sSL https://get.docker.com/ | sh && sudo usermod -aG docker ${USER}

Install within a Dockerfile (Buildkit)

FROM ubuntu:latest

Keybase proof

I hereby claim:

  • I am niko-dunixi on github.
  • I am nikodunixi (https://keybase.io/nikodunixi) on keybase.
  • I have a public key ASDxUhyLDLRAjbaF5d2INm9NVObRCyfEAskGAnq9x67LEQo

To claim this, I am signing this object: