Skip to content

Instantly share code, notes, and snippets.

View okasurya's full-sized avatar
🦑
is this a real life

Oka okasurya

🦑
is this a real life
View GitHub Profile
@okasurya
okasurya / clean_tf.sh
Created February 7, 2025 01:25
clean up terraform artifacts
# with help of gpt.
#!/bin/bash
# Define the root directory of the IaC project
ROOT_DIR=$(pwd)
# Find and clean up all .terraform folders and .terraform.lock.hcl files in the IaC project
echo "Searching for .terraform folders and .terraform.lock.hcl files in the project..."
find "$ROOT_DIR" -type d -name ".terraform" | while read -r DIR; do
@okasurya
okasurya / bookmark.sh
Last active February 5, 2025 04:40
Convert list of links to html format that can be exported to firefox.
# most of the code was written by gpt with minor tweaks
# to create folder, use this format `-- foo` the link below that line will be part of `foo` folder.
#!/bin/bash
# Input file (the text file with links and folder directives)
INPUT_FILE=$1
# Output HTML file
OUTPUT_FILE=$2
@okasurya
okasurya / userChrome.css
Last active June 11, 2024 05:09
Firefox hide tab
/*
about:config
toolkit.legacyUserProfileCustomizations.stylesheets
about:support
Profile Folder
chrome/userChrome.css
*/
.tabbrowser-tab {
@okasurya
okasurya / gs-app-id.md
Created October 13, 2021 17:43
Google Script App Library Id
@okasurya
okasurya / gotest.sh
Last active February 28, 2023 07:05
go test coverage cheatsheet
go test -covermode=count -coverprofile=count.out ./...
go tool cover -func=count.out
go tool cover -html=count.out
go tool cover -func=count.out | grep total: | awk '{print $3}'
go tool cover -func cover.out | grep total | awk '{print substr($3, 1, length($3)-1)}'
# sauce

Keybase proof

I hereby claim:

  • I am okasurya on github.
  • I am brlnt (https://keybase.io/brlnt) on keybase.
  • I have a public key ASDygJvTKMC0rpc2CgwatO9z9TgxBKUEqwMxv2O_fqvIogo

To claim this, I am signing this object:

@okasurya
okasurya / touchpad-toggle.sh
Created September 25, 2020 09:20
Toggle synaptics touchpad on/off
#!/bin/bash
synclient TouchpadOff=$(synclient -l | grep -c 'TouchpadOff.*=.*0'
# https://wiki.archlinux.org/index.php/Touchpad_Synaptics
# P.S.: It won't turn off the touchpad button
@okasurya
okasurya / docker-cheatsheet.sh
Last active August 27, 2022 02:43
my docker cheatsheet
#!/bin/sh
# stop / remove all docker containers
docker stop $(docker ps -a -q)
docker rm $(docker ps -a -q)
# docker compose up in background, change ${composefile} with docker compose yaml file name
docker-compose ${composefile}.yml up -d
# add --remove-orphans to remove containers for services not defined in the Compose file.
@okasurya
okasurya / find-file.md
Last active December 16, 2020 16:51
A bunch of shell scripts to find files with certain conditions

find file that doesn't contain some text

find . -iname 'filename/pattern(e.g: *.java)' -exec grep -H -E -o -c 'parameter' {} \; | grep :0$ | sed 's/..$//'
  • change filename/pattern(e.g: *.java) with target directory path
  • change parameter with text you want to exclude

source & explanation:

@okasurya
okasurya / Pro1.terminal
Created April 21, 2019 15:25
Mac Terminal Profiles
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>ANSIBlueColor</key>
<data>
YnBsaXN0MDDUAQIDBAUGKyxYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3AS
AAGGoKcHCBMZHSQoVSRudWxs1QkKCwwNDg8QERJcTlNDb21wb25lbnRzVU5TUkdCXE5T
Q29sb3JTcGFjZV8QEk5TQ3VzdG9tQ29sb3JTcGFjZVYkY2xhc3NPECcwLjI1MTk2MjE1
NTEgMC4zOTA2NDMyMzkgMC42MjM1NTU0MjE4IDFPECcwLjE1OTQ0MTYyMDEgMC4zMTI1