Skip to content

Instantly share code, notes, and snippets.

View Lunchb0ne's full-sized avatar
🙃
Probably procrastinating...

Abhishek Aryan Lunchb0ne

🙃
Probably procrastinating...
View GitHub Profile
@Lunchb0ne
Lunchb0ne / playground.ts
Created December 24, 2023 11:46
Advent of Typescript Day 13
// There's only so many ways you can do an accumulator in ts
type Accumulator<N extends number, Acc extends ReadonlyArray<unknown> = []> = Acc extends {
length: N;
}
? Acc
: Accumulator<N, [...Acc, unknown]>;
// Make a Union of the indexes excluding 0
type IndexUnion<A extends ReadonlyArray<unknown>> = Exclude<
{
@Lunchb0ne
Lunchb0ne / pf.conf
Created August 6, 2022 20:33
A way to bypass reset attacks that some ISP use for censorship. Works on macOS 12.5.
#
# Default PF configuration file.
#
# This file contains the main ruleset, which gets automatically loaded
# at startup. PF will not be automatically enabled, however. Instead,
# each component which utilizes PF is responsible for enabling and disabling
# PF via -E and -X as documented in pfctl(8). That will ensure that PF
# is disabled only when the last enable reference is released.
#
# Care must be taken to ensure that the main ruleset does not get flushed,
@Lunchb0ne
Lunchb0ne / pwsh_$PROFILE.ps1
Created June 7, 2022 00:23
My PowershellCore Profile
# ~/Documents/PowerShell/Microsoft.PowerShell_profile.ps1
Invoke-Expression (&starship init powershell)
# Zoxide invoker
Invoke-Expression (& {
$hook = if ($PSVersionTable.PSVersion.Major -lt 6) { 'prompt' } else { 'pwd' }
(zoxide init --hook $hook powershell) -join "`n"
})
# GitKraken function
@Lunchb0ne
Lunchb0ne / conda-bubbles.json
Created February 14, 2022 19:43
My custom bubbles config for oh-my-posh, hides the python segment if env is base, useful for people using anaconda/mamba and want to hide the env if it's not set to anything
{
"$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
"blocks": [
{
"alignment": "right",
"segments": [
{
"background": "#29315A",
"foreground": "#E64747",
"leading_diamond": "\ue0b6",
@Lunchb0ne
Lunchb0ne / config.py
Created November 9, 2020 13:24
Configuring plotly for usage with horizon theme
# include this code in your notebook to apply the theming
import plotly.io as pio
# Custom plotly theme for horizon
pio.templates["plotly_dark_horizon"] = pio.templates["plotly_dark"]
pio.templates["plotly_dark_horizon"]['layout']['paper_bgcolor'] = '#232530'
pio.templates["plotly_dark_horizon"]['layout']['plot_bgcolor'] = '#232530'
pio.templates.default = 'plotly_dark_horizon'
@Lunchb0ne
Lunchb0ne / abh.json
Last active June 2, 2019 20:51
A gist for storing all the mess schedules.
[
{
"day": "Monday",
"breakfast": [
"Aloo Parantha",
"Omelette"
],
"lunch": [
"Capsicum Chilli, Raita",
"Rajma"
@Lunchb0ne
Lunchb0ne / ovpns.sh
Last active February 23, 2024 21:22
SETUP VPN Server
# Executable transcript of https://www.digitalocean.com/community/tutorials/how-to-set-up-an-openvpn-server-on-ubuntu-16-04
sudo apt update
sudo apt install -y openvpn easy-rsa python
make-cadir ~/openvpn-ca
cd ~/openvpn-ca
cat <<EOT >> vars
# New values
export KEY_COUNTRY="EE"
export KEY_PROVINCE="Some Province"