Skip to content

Instantly share code, notes, and snippets.

@TheMartianObserver
TheMartianObserver / errs.go
Created March 2, 2021 04:43 — forked from grahamking/errs.go
Collect and handle multiple errors in Go
package util
import (
"errors"
"strings"
)
// Errs is an error that collects other errors, for when you want to do
// several things and then report all of them.
type Errs struct {
@TheMartianObserver
TheMartianObserver / obj-go-reader.go
Created March 2, 2021 18:11 — forked from davemackintosh/obj-go-reader.go
Really simple OBJ loader in Golang. Done this loads in C++ and thought I'd see how easy it was in Go, turns out it's really easy.
package model
import (
"fmt"
"io"
"os"
"github.com/go-gl/mathgl/mgl32"
)
@TheMartianObserver
TheMartianObserver / vpn-openconnect-connect-to-cisco-anyconnect.md
Created March 31, 2021 04:37 — forked from stefancocora/vpn-openconnect-connect-to-cisco-anyconnect.md
Split tunneling with openconnect - A guide on how to use openconnect to establish a vpn connection to an enterprise cisco anyconnect vpn endpoint with client side routing.

Introduction

The purpose of this short howto is to show you how to:

  • use openconnect [1] to connect to an enterprise cisco anyconnect endpoint
  • whilst minimizing the amount of traffic that your route through the vpn connection

Usually VPN administrators will puth the default route to the users, so that all user traffic is routed through the vpn connection. This is to address the various security concerns around compromised user computers bridging external internet traffic into the secure VPN network.

While the VPN administrator can push routes to the clients, the client can ignore these default routes and establish client side routing so that only the required A.B.C.D/E network is routed through the VPN. All other traffic will still use the clients default route and default outbound internet connection.

@TheMartianObserver
TheMartianObserver / gist:715c9fab4b6d4ccf8e21a77d5b81bc5b
Created September 15, 2021 02:01
Building nappgui SDK with Xcode -- CMake Output (001)
❯ cmake -G "Xcode" ../nappgui_sdk/src
CMake Deprecation Warning at CMakeLists.txt:4 (cmake_minimum_required):
Compatibility with CMake < 2.8.12 will be removed from a future version of
CMake.
Update the VERSION argument <min> value or use a ...<max> suffix to tell
CMake that the project does not need compatibility with older versions.
-- The C compiler identification is AppleClang 12.0.5.12050022
@TheMartianObserver
TheMartianObserver / gist:2e7d2f7ccd980ec95ade741f35f6fe6c
Created September 15, 2021 02:05
Building nappgui SDK with Xcode -- Build Output (001)
❯ xcodebuild
Command line invocation:
/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild
User defaults from command line:
IDEPackageSupportUseBuiltinSCM = YES
note: Using new build system
note: Planning build
note: Analyzing workspace
@TheMartianObserver
TheMartianObserver / magic_ring.cpp
Created September 15, 2021 11:41 — forked from rygorous/magic_ring.cpp
The magic ring buffer.
#define _CRT_SECURE_NO_DEPRECATE
#include <stdio.h>
#include <string.h>
#include <Windows.h>
// This allocates a "magic ring buffer" that is mapped twice, with the two
// copies being contiguous in (virtual) memory. The advantage of this is
// that this allows any function that expects data to be contiguous in
// memory to read from (or write to) such a buffer. It also means that
/*
* SPSC Bounded Queue
* Based on public domain C++ version by mstump[1]. Released under
* the same license terms.
*
* [1] https://github.com/mstump/queues/blob/master/include/spsc-bounded-queue.hpp
*/
#if !defined(__ATOMIC_RELAXED)
@TheMartianObserver
TheMartianObserver / xcode-clang-vers
Created September 17, 2021 14:25 — forked from yamaya/xcode-clang-vers
Xcode clang version record
# Xcode 4.3.3
Apple clang version 3.1 (tags/Apple/clang-318.0.61) (based on LLVM 3.1svn)
Target: x86_64-apple-darwin11.4.0
Thread model: posix
# Xcode 4.3.2
Apple clang version 3.1 (tags/Apple/clang-318.0.58) (based on LLVM 3.1svn)
Target: x86_64-apple-darwin11.4.0
Thread model: posix
@TheMartianObserver
TheMartianObserver / mp42gif.sh
Created September 20, 2021 11:30 — forked from troyane/mp42gif.sh
See script and documentation here: https://github.com/troyane/StackOverflow-pro/tree/master/mp42gif Script to convert MP4 file to GIF (via ffmpeg). It creates intermediate custom color palette out of input video file and use it for resulting GIF for better picture quality. For more info see https://superuser.com/a/556031
#!/bin/bash
#
# Script to convert MP4 video to GIF with generation of custom color palette.
#
#=== Do not touch code below
# Inner variables
input_file=""
input_fps="20"
input_height="512"
@TheMartianObserver
TheMartianObserver / adding-tailscale-to-edgerouter.md
Created January 8, 2022 03:42 — forked from lg/adding-tailscale-to-edgerouter.md
Add tailscale to an EdgeRouter and surviving system upgrade

Adding tailscale to an EdgeRouter (and surviving system upgrades)

I suggest you run sudo bash on all of these so you're the root user.

Installing

  1. Download tailscale and put the files in /config/. Find the latest stable or unstable version for your EdgeRouter's processor (ex. ER4 is mips and ERX is mipself)
sudo bash    # if you havent already