Skip to content

Instantly share code, notes, and snippets.

View jacobsalmela's full-sized avatar
:octocat:
To all that makes us unique

Jacob Salmela jacobsalmela

:octocat:
To all that makes us unique
View GitHub Profile
type Calculator struct {
ui.Node
Display string
}
func NewCalculator() *Calculator {
c := &Calculator{}
c.Build(c)
return c
}
@leiless
leiless / check_in_container.sh
Last active February 19, 2023 13:14
Check if the script is running in the Docker/Podman/K8S
#!/bin/bash
# If you using sh, please remove the `-o pipefail`
set -eufo pipefail
#set -x
check_in_container() {
if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && [ -z ${KUBERNETES_SERVICE_HOST+x} ]; then
echo "[ERR] This script should be run inside a container environment!"
exit 1
@protosam
protosam / Dockerfile
Last active January 4, 2024 19:59
Nvidia Jetson sdkmanager in Docker Notes
FROM ubuntu:18.04
# Install SDK deps
RUN apt-get update
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y \
libgconf-2-4 \
libcanberra-gtk-module \
locales \
apiVersion: apps/v1
kind: DaemonSet
metadata:
labels:
name: startup
name: startup
namespace: default
spec:
selector:
matchLabels:
@makew0rld
makew0rld / go-build-all.sh
Last active March 13, 2023 11:22
Cross compile for all possible Golang targets. This script will always be updated, because it uses the `go` command to see what can be built.
#!/usr/bin/env bash
# Based on https://gist.github.com/eduncan911/68775dba9d3c028181e4
# but improved to use the `go` command so it never goes out of date.
type setopt >/dev/null 2>&1
contains() {
# Source: https://stackoverflow.com/a/8063398/7361270
[[ $1 =~ (^|[[:space:]])$2($|[[:space:]]) ]]
package main
import (
"context"
"fmt"
"net"
"os/exec"
"strconv"
"strings"
"sync"
@vertan
vertan / ssh_badge
Created July 10, 2018 15:21
Dynamic Badge depending on environment in iTerm/SSH
# Put this in ~/.ssh/config
Host *.production.host.net
LocalCommand echo -e "\033]50;SetProfile=Production\a"
Host *.staging.host.net
LocalCommand printf "\033]50;SetProfile=Staging\a\e[0;m"
Host *
PermitLocalCommand yes
# End ~/.ssh/config
@khang06
khang06 / 0-SD-GUIDE.md
Last active March 10, 2024 23:47
Switch SD Dumping 101

https://gbatemp.net/threads/nintendo-switch-sd-to-nsp-dumper.514816/ for a more automated and easier way to do this

This guide assumes you have previous experience with hactool and messing with your NAND. You aren't supposed to blindly copy commands in this, so read before pasting!

Also, the Python sections require Python 2.7 and pycrypto. Make sure your hactool is v1.2 or above.

Obtaining Your SD Seed

  1. Run https://cdn.discordapp.com/attachments/432400335235973120/478053328857726976/Compelled-Disclosure.nro (source at https://github.com/shadowninja108/Compelled-Disclosure, thx Shadów#6239)
@mholt
mholt / macapp.go
Last active April 8, 2024 17:54
Distribute your Go program (or any single binary) as a native macOS application
// Package main is a sample macOS-app-bundling program to demonstrate how to
// automate the process described in this tutorial:
//
// https://medium.com/@mattholt/packaging-a-go-application-for-macos-f7084b00f6b5
//
// Bundling the .app is the first thing it does, and creating the DMG is the
// second. Making the DMG is optional, and is only done if you provide
// the template DMG file, which you have to create beforehand.
//
// Example use:
#!/usr/bin/env bash
# clock_skew.sh - Check remote hosts for clock skew (time drift), and
# output a warning or alert message based on defined thresholds.
#
# Instructions:
# Create a hosts.txt file that contains the list of hosts to be checked.
#
# hosts.txt should contain one host entry per line, and username and
# port fields are optional. Format:
#