Skip to content

Instantly share code, notes, and snippets.

@jeremychone
jeremychone / rust-xp-02-postgresql-sqlx.rs
Created May 11, 2021 05:48
Rust to PostgreSQL with SQLX | Rust By Example
#![allow(unused)] // silence unused warnings while exploring (to comment out)
use sqlx::postgres::{PgPoolOptions, PgRow};
use sqlx::{FromRow, Row};
// Youtube episode: https://youtu.be/VuVOyUbFSI0
// region: Section
// Start postgresql server docker image:
@ityonemo
ityonemo / test.md
Last active April 29, 2025 08:28
Zig in 30 minutes

A half-hour to learn Zig

This is inspired by https://fasterthanli.me/blog/2020/a-half-hour-to-learn-rust/

Basics

the command zig run my_code.zig will compile and immediately run your Zig program. Each of these cells contains a zig program that you can try to run (some of them contain compile-time errors that you can comment out to play with)

@mattbell87
mattbell87 / remote-wsl.md
Last active April 25, 2025 17:28
VSCode Remote: Connect to WSL2 from another machine

VSCode Remote: Connect to WSL2 from another machine

Do you want to do remote development on your WSL2 container in Visual Studio Code? Read this.

Proxy jump method

  1. On the host set up OpenSSH for Windows
  2. Run wsl --update to make sure you are running the latest WSL
  3. Open WSL and install another SSH server inside WSL with sudo apt-get install openssh-server
  4. Now run sudo systemctl enable --now ssh to automatically start ssh when WSL starts.
@cellularmitosis
cellularmitosis / HashTable.c
Last active May 10, 2023 02:46
Hash table in C, part 1: a humble beginning
#include "HashTable.h"
#include <stdio.h> // fprintf
#include <stdlib.h> // exit
#include <string.h> // memset
#include <stdint.h> // uint8_t
void* dmalloc(size_t size) {
void* p = malloc(size);
if (p == NULL) {
@Zantier
Zantier / cmd-colors.reg
Last active April 15, 2025 20:57
Registry file: Add WSL Ubuntu Bash to the context menu of folders in File Explorer.
Windows Registry Editor Version 5.00
; Delete directories under HKEY_CURRENT_USER\Console, then run this
; Examples: https://gist.github.com/P4/4245793
[HKEY_CURRENT_USER\Console]
"WindowAlpha"=dword:000000cd
"DefaultBackground"=dword:00000000
; black dgray
"ColorTable00"=dword:00141414
@Integralist
Integralist / Long and Short Flag.go
Last active January 3, 2024 19:35
[Golang Long and Short Flags] #go #golang #flags
var myFlagType string
func init() {
const (
flagValue = "default value is foo"
flagUsage = "this is my flag explanation"
)
flag.StringVar(&myFlagType, "foo", flagValue, flagUsage)
flag.StringVar(&myFlagType, "f", flagValue, flagUsage+" (shorthand)")
flag.Parse()
@syneart
syneart / build_wireshark.sh
Last active April 11, 2025 05:03
BUILD WIRESHARK ON UBUNTU OR DEBIAN
#!/bin/sh
# This shell script is made by SyneArt <[email protected]>
#######################################
# BUILD WIRESHARK ON UBUNTU OR DEBIAN #
#######################################
# | THIS SCRIPT IS TESTED CORRECTLY ON |
# |----------------------------------------------------------|
# | OS | Wireshark | Test | Last test |
# |--------------------|----------------|------|-------------|
@nilesh-tawari
nilesh-tawari / LUA.lua
Created January 25, 2018 04:11
LUA cheatSheet
-- [[ Cheatsheet for LUA from http://www.newthinktank.com/2015/06/learn-lua-one-video/]]
-- Prints to the screen (Can end with semicolon)
print("Hello World")
--[[
Multiline comment
]]
-- Variable names can't start with a number, but can contain letters, numbers
@santisbon
santisbon / Search my gists.md
Last active May 5, 2025 21:07
How to search gists.

Enter this in the search box along with your search terms:

Get all gists from the user santisbon.
user:santisbon

Find all gists with a .yml extension.
extension:yml

Find all gists with HTML files.
language:html

@davecan
davecan / open_powershell_here.md
Last active January 27, 2025 01:16
How to enable "Open PowerShell Here" context menu in Windows 10