Skip to content

Instantly share code, notes, and snippets.

@daehahn
daehahn / wsl2-network.ps1
Last active April 29, 2024 08:27
WSL 2 TCP NETWORK FORWARDING
# WSL2 network port forwarding script v1
# for enable script, 'Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope CurrentUser' in Powershell,
# for delete exist rules and ports use 'delete' as parameter, for show ports use 'list' as parameter.
# written by Daehyuk Ahn, Aug-1-2020
# Display all portproxy information
If ($Args[0] -eq "list") {
netsh interface portproxy show v4tov4;
exit;
}
@rafaelglikis
rafaelglikis / sleep_ms.c
Created April 7, 2017 16:42
Cross-platform sleep function for C
/**
* Cross-platform sleep function for C
* @param int milliseconds
*/
void sleep_ms(int milliseconds)
{
#ifdef WIN32
Sleep(milliseconds);
#elif _POSIX_C_SOURCE >= 199309L
struct timespec ts;
@vncsna
vncsna / bash_strict_mode.md
Created June 6, 2021 01:59 — forked from mohanpedala/bash_strict_mode.md
set -e, -u, -o, -x pipefail explanation

set -e, -u, -o, -x pipefail

The set lines

  • These lines deliberately cause your script to fail. Wait, what? Believe me, this is a good thing.
  • With these settings, certain common errors will cause the script to immediately fail, explicitly and loudly. Otherwise, you can get hidden bugs that are discovered only when they blow up in production.
  • set -euxo pipefail is short for:
set -e
set -u
========= ========== ===== =====
========= ============ ====== ======
=== === ==== ===== =====
=== ========= ====== ====== INSTALLIN' THAT SWEET SWEET
=== ======== ============= BIG IRON ON YOUR LINUX LAPTOP
=== ========= ============= OR SERVER - BY MR. SKILLFULL
=== === ==== === === ===
========= ============ ===== = =====
========= ========== ===== =====
@rxaviers
rxaviers / gist:7360908
Last active April 29, 2024 08:22
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: πŸ˜„ :smile: πŸ˜† :laughing:
😊 :blush: πŸ˜ƒ :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
πŸ˜† :satisfied: 😁 :grin: πŸ˜‰ :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: πŸ˜€ :grinning:
πŸ˜— :kissing: πŸ˜™ :kissing_smiling_eyes: πŸ˜› :stuck_out_tongue:
@estsaon
estsaon / wsl-port-forwarding.md
Last active April 29, 2024 08:21
How to SSH into WSL2 on an external Window

WSL:

  1. Install openssh-server:
sudo apt install openssh-server
  1. Add or uncomment following lines in /etc/ssh/sshd_config:
@sandcastle
sandcastle / oracle_guid_helpers.sql
Last active April 29, 2024 08:19
Oracle GUID helper functions for converting between GUID and RAW(16)
set serveroutput on;
declare
raw_guid raw(16);
guid varchar2(64);
begin
raw_guid := guid_to_raw ('88c6a267-65d2-48d6-8da2-6f45e2c22726');
guid := raw_to_guid('67A2C688D265D6488DA26F45E2C22726');
@markmals
markmals / effect-stream.ts
Created December 4, 2023 16:48
Create an async iterable stream of values from a Solid.js signal effect
import { createMemo, createEffect } from 'solid-js';
export async function* createEffectStream<T>(fn: () => T) {
let promises: Promise<T>[] = [];
let resolve: (value: T) => void;
promises.push(
new Promise(r => {
resolve = r;
}),
);
@nuno-azevedo
nuno-azevedo / gitlab-to-github.sh
Last active April 29, 2024 08:15
Import Repository from GitLab to GitHub
#!/bin/bash
# Arguments:
# ${1}: Username
# ${2}: Repository
# Clone the repo from GitLab using the `--mirror` option.
git clone --mirror "git@gitlab.com:${1}/${2}.git"
# Push to GitHub using the `--mirror` option. The `--no-verify` option skips any hooks.