Skip to content

Instantly share code, notes, and snippets.

@Duckle29
Duckle29 / Persistent reverse SSH tunnel.md
Last active November 11, 2024 11:21
A systemd service file to ensure a persistent reverse SSH tunnel is active

Persistent reverse-ssh-tunnel systemd unit

This unit file, if enabled on boot, will attempt to connect to a remote server and establish a reverse tunnel. It uses StrictHostKeyChecking=accept-new for the ssh connection, so if you want to make sure the host you're connecting to is the right one, carry out the first connection manually and check the key.

REMOTE is considered a remote server that's available over ssh
LOCAL is considered the device initiating the remote tunnel. This will likely be a device dropped behind a NAT with no option of portforwarding

To use it, copy this multiline command somewhere to edit the configs and run it as root on the device:

@antifuchs
antifuchs / dock.nix
Last active September 14, 2025 13:23
A nix module that arranges the macOS dock the way you want it. Note: It won't allow you to manually re-arrange the items on it; the dock gets reset everytime you log in.
{ config, pkgs, lib, ... }:
with lib;
let
cfg = config.local.dock;
stdenv = pkgs.stdenv;
in
{
options = {
local.dock.enable = mkOption {
description = "Enable dock";
@goliatone
goliatone / generate_rsa_ssh_keys.go
Last active August 28, 2025 09:34 — forked from azakordonets/generate_rsa_ssh_keys.go
Generate SSH RSA Private/Public Key pair with Golang
// This shows an example of how to generate a SSH RSA Private/Public key pair and save it locally
package main
import (
"crypto/rand"
"crypto/rsa"
"crypto/x509"
"encoding/pem"
"golang.org/x/crypto/ssh"
@br3ndonland
br3ndonland / github-actions-notes.md
Last active November 25, 2025 23:54
Getting the Gist of GitHub Actions
@Dev1an
Dev1an / CGPoint+SIMD.swift
Created August 8, 2020 10:32
SIMD extensions for CGPoint and CGSize
import struct CoreGraphics.CGSize
import struct CoreGraphics.CGPoint
import struct CoreGraphics.CGFloat
extension CGSize: SIMD {
public typealias MaskStorage = SIMD2<CGFloat.NativeType.SIMDMaskScalar>
public subscript(index: Int) -> CGFloat {
get {
index == 0 ? width : height
@yiplee
yiplee / permision_test.go
Last active September 10, 2024 04:13
install stringer: go get -u -a golang.org/x/tools/cmd/stringer
package core
import (
"testing"
)
func TestPermissionFromName(t *testing.T) {
for i := 0; i < len(_Permission_index)-1; i++ {
left, right := _Permission_index[i], _Permission_index[i+1]
name := _Permission_name[left:right]
@ksurent
ksurent / bf.rs
Last active May 7, 2023 16:41
Toy Brainfuck interpreter in Rust.
use std::fmt;
use std::io;
use thiserror::Error;
fn main() {
let mut bf = Bf::new(1000, true);
let mut input = String::new();
loop {
match io::stdin().read_line(&mut input) {
Ok(0) => return,
@rahularity
rahularity / work-with-multiple-github-accounts.md
Last active January 6, 2026 22:30
How To Work With Multiple Github Accounts on your PC

How To Work With Multiple Github Accounts on a single Machine

Let suppose I have two github accounts, https://github.com/rahul-office and https://github.com/rahul-personal. Now i want to setup my mac to easily talk to both the github accounts.

NOTE: This logic can be extended to more than two accounts also. :)

The setup can be done in 5 easy steps:

Steps:

  • Step 1 : Create SSH keys for all accounts
  • Step 2 : Add SSH keys to SSH Agent
@timroster
timroster / lets-encrypt-free-iks.md
Last active September 1, 2022 02:29
Creating Let's Encrypt certificates for IBM free Kubernetes clusters

Creating Let's Encrypt certificates for IBM free Kubernetes clusters

The IBM Kubernetes service free clusters consist of a single worker node with 2 CPU and 4 GB of memory for experimenting with Kubernetes. Unlike the fee-based service, these clusters do not include capabilities for application load balancing using ingress out-of-the-box. However, if you manage a DNS domain (any provider will suffice) and can add an A record, it's possible for you to configure your own ingress that can provide http and https session termination for your containerized applications. Getting a TLS-enabled website or simply an external REST API couldn't be easier!

Prerequisites

  • Free IBM Kubernetes Cluster (IKS) - upgrade your account from Lite plan to create one. In the example commands, we'll assume that this cluster is named mycluster
  • kubectl - match your cluster API version (as of 12/5/20 - this is ~1.18.12)
  • helm v3
  • DNS domain that you can edit to configure
@Dainerx
Dainerx / chat.go
Created May 5, 2020 15:41
Chat is a server that lets clients chat with each other
// Chat is a server that lets clients chat with each other.
// For n clients: 2n+2 concurrent communications
package main
import (
"bufio"
"fmt"
"log"
"net"
"time"