Skip to content

Instantly share code, notes, and snippets.

View tecandrew's full-sized avatar

Andrew tecandrew

View GitHub Profile
@tecandrew
tecandrew / init.vim
Created July 27, 2022 21:43
a .vimrc file for neovim for 4-spaced tabs. place in ~/.config/nvim/
set tabstop=4 softtabstop=4
set shiftwidth=4
set expandtab
set smartindent
set nu
@tecandrew
tecandrew / wsl-1password-integration.md
Last active September 16, 2024 21:55
WSL/WSL2 Integration with 1Password SSH

On Windows Side

Enable 1Password's SSH Agent.

Using Powershell, install npiperelay via the scoop package manager.

Set-ExecutionPolicy RemoteSigned -Scope CurrentUser # Optional: Needed to run a remote script the first time
irm get.scoop.sh | iex  # install scoop
scoop install git
@tecandrew
tecandrew / pytorch-apple-silicon-test.py
Last active November 9, 2022 18:07
Test Apple M1 Pytorch
import torch
import math
# this ensures that the current MacOS version is at least 12.3+
print(torch.backends.mps.is_available())
# this ensures that the current current PyTorch installation was built with MPS activated.
print(torch.backends.mps.is_built())
dtype = torch.float
device = torch.device("mps")
@tecandrew
tecandrew / gitlab-archive-python-api.py
Last active November 9, 2022 18:08
GitLab Archive Using Python API
#!/usr/bin/env python3
from zipfile import ZipFile
import os
import time
from gitlab import (
Gitlab,
)
API_TOKEN = ''
@tecandrew
tecandrew / python-problem-matcher.md
Last active November 9, 2022 18:07
Python Problem Matcher for VS Code

VS Code

There is no native Python "problemMatcher" for vscode tasks. Use the regexp pattern to make it work for basic tasks.

"problemMatcher":
    {
        "fileLocation": "absolute",
        "pattern": [
 {
@tecandrew
tecandrew / reset.sh
Created November 28, 2022 20:53
Reset git submodules (recursive)
#!/bin/bash
git fetch && git reset --hard @{u} && git submodule deinit --all -f && git submodule update --init
@tecandrew
tecandrew / README.md
Created January 18, 2023 02:01
Enable Hyper-V Manager on Windows 11 Home
@tecandrew
tecandrew / do-spaces-minio.py
Last active July 31, 2024 23:51
digitalocean-minio
from minio import Minio
from minio.datatypes import Object
import os
ACCESS_KEY = os.environ.get("ACCESS_KEY")
SECRET_KEY = os.environ.get("SECRET_KEY")
# Create client with access key and secret key with specific region.
client = Minio(
"sfo3.digitaloceanspaces.com",

Tailscale for Non-Standard Linux

This is meant for Linux distributions that do not have a "traditional" like environment Linux environment like Ubuntu or Debian, but instead more like "bare metal" or "embedded" Linux like Yocto or Buildroot.

  1. Download Tailscale (other distros) curl -O https://pkgs.tailscale.com/stable/tailscale_x.xx.xx.xx.tar.gz

  2. Extract the tarball tar -xvf tailscale-linux-x.xx.tar.gz

@tecandrew
tecandrew / trust-mullvad.sh
Last active December 5, 2024 02:56
Tailscale Lock: Trust Mullvad VPN Nodes
#!/usr/bin/env bash
tailscale lock status | \
grep '.mullvad.ts.net' | \
awk -F'nodekey:' '/nodekey:/ {print $2}' | \
while read nodekey; do
echo "Signing nodekey: $nodekey"
tailscale lock sign "nodekey:$nodekey"
sleep 1
done