Skip to content

Instantly share code, notes, and snippets.

@anakaiti
anakaiti / vc_redistr.md
Last active September 5, 2024 15:29 — forked from ChuckMichael/vc_redistr.md
Install all Visual C++ Redistributables using only one command!

Warning

App Installer must be installed on Win10/11.

cmd/powershell

Tip

You can save it and run as batch file (.bat).

@anakaiti
anakaiti / pop_runners.py
Created June 6, 2022 13:36
Remove all offline gitlab runners in a group
import os
import requests
import urllib.parse
GITLAB_AUTH_TOKEN = ''
GROUP_ID = ''
headers = {"PRIVATE-TOKEN": GITLAB_AUTH_TOKEN}
r = requests.get(
@anakaiti
anakaiti / vault-edit.fish
Last active November 25, 2020 10:43
fish shell hashicorp vault helpers
function vault-edit --argument key
set file (mktemp --suffix=.json)
vault read -format=json $key | jq '.data' > $file
$EDITOR $file
vault write $key @$file
end
@anakaiti
anakaiti / .userstyles.md
Last active June 20, 2020 15:17
Userstyles

Userstyles

Click on the raw button to install.

# Selects and connects to a vpn
# Put .ovpn files in ~/vpn
function vpn --description 'Connect to vpn'
# Change to your prefered browser
set browser firefox
sudo -v
set ovpn ~/vpn/(ls ~/vpn/*.ovpn | tr '/' '.' | cut -d '.' -f 5 | fzf).ovpn
if test -e {$ovpn}.url
@anakaiti
anakaiti / youtube.fish
Last active June 2, 2020 16:28
Fish script to download youtube videos partially
function youtube -d 'Download partial youtube videos' -a url start duration out
set mp4 (youtube-dl -g -f 22 $url)
set -q out; or set out 'out.mp4'
ffmpeg -ss $start -i $mp4 -t $duration -c copy $out
end
@anakaiti
anakaiti / watchlive.fish
Last active June 9, 2020 03:31
Watch youtube live stream using streamlink, mpv & open popout chat in fish shell script
function watchlive --description 'Watch youtube live stream' --argument url mode
set url (string match -r 'v=[^&]+' $url)
google-chrome --new-window "--app=https://www.youtube.com/live_chat?is_popout=1&$url" &
set prefix streamlink --retry-streams 5
set suffix "https://www.youtube.com/watch?$url"
if [ "$mode" = 'audio' ]
# 144p & 240p: AAC-HEv2 2ch 48Khz 48Kbps
# 360p & 480p: AAC-LC 2ch 48Khz 128Kbps
@anakaiti
anakaiti / README.md
Last active April 4, 2020 04:05
Cloudflare Warp+ Comparison

Cloudflare Warp+ comparison

Test Environment

ISP

{
  "ip": "175.158.50.19",
  "hostname": "ip-175-158-50-19.cbn.net.id",
 "city": "Jakarta",
@anakaiti
anakaiti / update-terraform.fish
Created March 10, 2020 09:18
Terraform update script for fish shell
function update-terraform --description 'Updates terraform to the latest version'
set -l base 'https://releases.hashicorp.com/terraform'
set -l ver (curl -s $base/ | grep '<a href="/terraform/' | head -n1 | cut -d'/' -f 3)
set -l tmpdir (mktemp -d)
wget -O $tmpdir/tf.zip $base/$ver/terraform_"$ver"_linux_amd64.zip
unzip $tmpdir/tf.zip -d $tmpdir
install $tmpdir/terraform (which terraform)
terraform version
end
@anakaiti
anakaiti / unique-list.tf
Created August 12, 2019 05:02
Terraform unique list
locals {
listA = [1, 2, 3, 4]
listB = [2, 3, 4, 5]
}
provider "local" {}
resource "local_file" "name" {
content = "${join(" ", distinct(concat(local.listA, local.listB)))}"
filename = "myfile.txt"