Skip to content

Instantly share code, notes, and snippets.

View bryan-hoang's full-sized avatar
🎯
Focusing

Bryan Hoang bryan-hoang

🎯
Focusing
View GitHub Profile
@KroniK907
KroniK907 / GitButler-WSL.md
Last active April 17, 2024 19:36
Installing GitButler on Windows via WSL

Installing GitButler on Windows via WSL - A Complete Guide

This guide will provide a complete walkthrough for getting GitButler setup and functioning on a windows environment using Windows Subsystem for Linux (WSL).

Please note that GitButler on windows via wsl is not well tested and not officially supported, though one of the top priorities of the GitButler team is to get a working windows build out asap. For now, however this is the easiest solution I have developed.

Prerequisites:

  • You must be running Windows 10 version 2004 and higher (Build 19041 and higher) or Windows 11 for this guide to work correctly.
  • I highly suggest using the windows terminal app for doing all the command line work if you are not using it already, though this is not required.

Known Issues

@alcatrazEscapee
alcatrazEscapee / BiMapRaceCondition.java
Created November 13, 2021 03:05
Race condition involving `BiMap.put` and `BiMap.get`, where `get` returns `null` despite no null ever being present in the map.
package bi_map_race_condition;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import com.google.common.collect.BiMap;
import com.google.common.collect.HashBiMap;
public class BiMapRaceCondition
{
/*
* This code is licensed under CC0 1.0. Use it, do whatever you want with it!
*/
import java.util.List;
import java.util.function.Predicate;
public class PerfectMatchingWithEdmondsMatrix
{
/**
@sindresorhus
sindresorhus / esm-package.md
Last active April 24, 2024 09:47
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.
@bryan-hoang
bryan-hoang / settings.json
Last active November 26, 2020 18:09
Microsoft Terminal Settings
// This file was initially generated by Windows Terminal 1.4.3243.0
// It should still be usable in newer versions, but newer versions might have additional
// settings, help text, or changes that you will not see unless you clear this file
// and let us generate a new one for you.
// To view the default settings, hold "alt" while clicking on the "Settings" button.
// For documentation on these settings, see: https://aka.ms/terminal-documentation
{
"$schema": "https://aka.ms/terminal-profiles-schema",
"alwaysShowTabs": true,
"theme": "system",
  • SC1000 $ is not used specially and should therefore be escaped.
  • SC1001 This \o will be a regular 'o' in this context.
  • SC1003 Want to escape a single quote? echo 'This is how it'\''s done'.
  • SC1004 This backslash+linefeed is literal. Break outside single quotes if you just want to break the line.
  • SC1007 Remove space after = if trying to assign a value (or for empty string, use var='' ... ).
  • SC1008 This shebang was unrecognized. ShellCheck only supports sh/bash/dash/ksh. Add a 'shell' directive to specify.
  • SC1009 The mentioned parser error was in ...
  • SC1010 Use semicolo

mysql2 gem + mariadb + Alpine Linux

tl;dr Use mariadb-dev. In case of Alpine Linux 3.8, 3.9, use mysql2 >= 0.4.10.

Starting with Alpine Linux 3.8 there are basically 2 options to install the mysql2 gem:

1.sh:

@mcpower
mcpower / aoc-tips.md
Last active March 27, 2024 03:28
Tips for getting on the Advent of Code leaderboard

Hi, I'm mcpower. I've done Advent of Code seriously for two years now in Python, placing 9th in 2018 and 12th in 2017. This year, I'm taking a break from aiming for the leaderboard - while it's fun and all, it is a bit stressful at times (the good kind of stress, though!). As such, I'd like to share a few tips for anyone wanting to aim for the leaderboard.

This is everything that worked for me. Your mileage may vary, though - don't take this as gospel, see what works for you.

Go fast

Go fast.

" Specify a directory for plugins
call plug#begin('~/.vim/plugged')
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'scrooloose/nerdtree'
"Plug 'tsony-tsonev/nerdtree-git-plugin'
Plug 'Xuyuanp/nerdtree-git-plugin'
Plug 'tiagofumo/vim-nerdtree-syntax-highlight'
Plug 'ryanoasis/vim-devicons'
Plug 'airblade/vim-gitgutter'
@coltenkrauter
coltenkrauter / fix-wsl2-dns-resolution
Last active April 24, 2024 17:00
Fix DNS resolution in WSL2
More recent resolution:
1. cd ~/../../etc (go to etc folder in WSL).
2. echo "[network]" | sudo tee wsl.conf (Create wsl.conf file and add the first line).
3. echo "generateResolvConf = false" | sudo tee -a wsl.conf (Append wsl.conf the next line).
4. wsl --terminate Debian (Terminate WSL in Windows cmd, in case is Ubuntu not Debian).
5. cd ~/../../etc (go to etc folder in WSL).
6. sudo rm -Rf resolv.conf (Delete the resolv.conf file).
7. In windows cmd, ps or terminal with the vpn connected do: Get-NetIPInterface or ipconfig /all for get the dns primary and
secondary.