Skip to content

Instantly share code, notes, and snippets.

View aluxian's full-sized avatar

Alexandru Rosianu aluxian

View GitHub Profile
@Maffsie
Maffsie / install-alpine.sh
Last active August 10, 2022 23:27
Hetzner-centric Alpine Linux provisioning script
#!/bin/sh
IPADDR=`ifconfig eth0 | grep 'inet ' | awk '{print $2}'`
IP6ADDR=`ifconfig eth0 | grep 'inet6 ' | awk '{print $2}' | grep -v '^f'`
DFROUTE=`route -n | grep '^0.0.0.0' | awk '{print $2}'`
DF6ROUTE="fe80::1"
IPSUB="27"
IP6SUB="64"
WORKDIR=`mktemp -d`
cd $WORKDIR
@markelliot
markelliot / getGoogleAuthToken.js
Last active July 22, 2025 01:17
Converts Google service user OAuth2 credentials into an access token in Cloudflare-compatible JS
/**
* Get a Google auth token given service user credentials. This function
* is a very slightly modified version of the one found at
* https://community.cloudflare.com/t/example-google-oauth-2-0-for-service-accounts-using-cf-worker/258220
*
* @param {string} user the service user identity, typically of the
* form [user]@[project].iam.gserviceaccount.com
* @param {string} key the private key corresponding to user
* @param {string} scope the scopes to request for this token, a
* listing of available scopes is provided at
@sindresorhus
sindresorhus / esm-package.md
Last active August 13, 2025 20:49
Pure ESM package

Pure ESM package

The package that linked you here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.
@bluewalk
bluewalk / GetNordVPNWireGuardDetails.md
Last active August 15, 2025 16:01
Getting NordVPN WireGuard details

About

Instructions to obtain WireGuard details of your NordVPN account. These can be used to setup a WireGuard tunnel on your router to NordVPN.

Source: https://forum.gl-inet.com/t/configure-wireguard-client-to-connect-to-nordvpn-servers/10422/27

Prerequisites

If you have any linux machine, use that or install a vm if you don't have one.

Get their official linux app installed. Make sure you have wireguard installed too. And set the used technology to Nordlynx by running nordvpn set technology nordlynx

# Instructions for fresh install
$ sh <(curl -L https://nixos.org/nix/install) --darwin-use-unencrypted-nix-store-volume --daemon
# reboot
$ source /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh
$ echo 'export NIX_PATH=darwin-config=$HOME/.nixpkgs/darwin-configuration.nix:$HOME/.nix-defexpr/channels${NIX_PATH:+:}$NIX_PATH' | tee -a ~/.zshrc
$ echo 'source $HOME/.nix-profile/etc/profile.d/hm-session-vars.sh' | tee -a ~/.zshrc
$ nix-channel --add https://nixos.org/channels/nixpkgs-unstable
$ nix-channel --add https://github.com/LnL7/nix-darwin/archive/master.tar.gz darwin
$ nix-channel --add https://github.com/nix-community/home-manager/archive/master.tar.gz home-manager
@mvasilenko
mvasilenko / terraform_cloudflare_import.sh
Created November 11, 2020 15:15
import Cloudflare DNS record into terraform state
# set your CloudFlare key & email
export auth_email=$CLOUDFLARE_EMAIL
export auth_key=$CLOUDFLARE_TOKEN
# list your DNS zones hosted at CloudFlare
curl -s -X GET "https://api.cloudflare.com/client/v4/zones/?per_page=100" -H "X-Auth-Email: $auth_email" -H "X-Auth-Key: $auth_key" -H "Content-Type: application/json"| jq -r '.result[] | "\(.id) \(.name)"'
# expected output:
# a3c9c7d3861e52cf23c835102c258d63 example1.com
# f47d1debb65621ca89039b9fbfeb726a example2.com
@salrashid123
salrashid123 / cos_gcp_direct.md
Created October 20, 2020 15:32
Create LUKS mount on GCP COS image (direct)

Stage Disk with LUKS (direct)

Procedure to mount a LUKS encrypted device into a Container Optimized OS.

  • Create a disk and attach to a plain VM
  • Create format and mount as LUKS
  • Write file to LUKS mount path
@rsms
rsms / foo.service
Created October 3, 2020 00:18
Example go http server with systemd socket activation and zero-downtime restart
[Unit]
Description = Foo HTTP server
Requires = foo.socket
After = multi-user.target
[Service]
User = www-data
Group = www-data
WorkingDirectory = /var/foo
ExecStart = /var/foo/bin/foo-server
#!/usr/bin/awk -f
function line(x1, y1, x2, y2) {
printf(" <line x1='%d' y1='%d' x2='%d' y2='%d'/>\n",
x1, y1 + rand() * 5, x2, y2 + rand() * 10)
}
function path(d) {
printf(" <path d='%s'/>\n", d)
}
@jsloat
jsloat / Bear.Backlinks.js
Last active December 27, 2022 23:27
Generate backlinks for Bear notes in Scriptable on iOS