Skip to content

Instantly share code, notes, and snippets.

View rockyprabowo's full-sized avatar

Rocky Prabowo rockyprabowo

View GitHub Profile
@rockyprabowo
rockyprabowo / tst.css
Last active March 20, 2023 16:30
Tree Style Tab CSS
/* Hide border on tab bar, force its state to 'scroll', adjust margin-left for width of scrollbar. */
#tabbar { border: 0; overflow-y: scroll !important; scrollbar-width: auto; }
/* Hide .twisty and adjust margins so favicons have 7px on left. */
tab-item .twisty {
visibility: hidden;
margin-left: -8px;
}
/* Push tab labels slightly to the right so they're completely hidden in collapsed state. */
@rockyprabowo
rockyprabowo / userChrome.css
Created November 22, 2022 15:15
Current userChrome.css for Firefox
#main-window[tabsintitlebar="true"]:not([extradragspace="true"]) #TabsToolbar > .toolbar-items {
opacity: 0;
pointer-events: none;
}
#main-window:not([tabsintitlebar="true"]) #TabsToolbar {
visibility: collapse !important;
}
:root { --thin-tab-width: 36px; }
:root { --wide-tab-width: 16vw; }
@rockyprabowo
rockyprabowo / docker-compose.yml
Created November 5, 2022 16:09
PostgreSQL + PgAdmin4 via Docker using Docker Compose
version: '3.9'
services:
ephemeral-db:
container_name: ephemeral-postgres
image: postgres:14-alpine
restart: always
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: app
@rockyprabowo
rockyprabowo / main.go
Created October 5, 2022 03:22
GORM Many-To-Many example
package main
import (
"fmt"
"gorm.io/driver/postgres"
"gorm.io/gorm"
"log"
"time"
)
@rockyprabowo
rockyprabowo / main.dart
Created August 19, 2021 06:53
Dart rotateBy implementation on List
extension ListRotate on List {
List rotateBy(int n) {
int i = n % length;
return this.sublist(i)..addAll(this.sublist(0, i));
}
}
void main() {
final a = [5, 6, 7, 8, 9];
final b = [5, 6, 7, 8, 9, 10];
@rockyprabowo
rockyprabowo / userChrome.css
Created April 9, 2021 14:53
My Firefox userChrome.css (Hide Tabs, auto expanding Tab Center Reborn, and custom Megabar Styler)
#main-window[tabsintitlebar="true"]:not([extradragspace="true"]) #TabsToolbar > .toolbar-items {
opacity: 0;
pointer-events: none;
}
#main-window:not([tabsintitlebar="true"]) #TabsToolbar {
visibility: collapse !important;
}
:root { --thin-tab-width: 36px; }
:root { --wide-tab-width: 16vw; }
@rockyprabowo
rockyprabowo / writable_nvm_dir_on_opt
Created March 30, 2021 05:18
Setup a nvm (node.js version manager) directory in /opt and made it writable by any user in "wheel" group
Make sure that:
- Your user is already in "wheel" group.
- ACL support is enabled in your root partition or the partition where you mount /opt.
$ cd /opt
$ su
# mkdir nvm
# chown root:wheel ./nvm
# chmod g+rwx ./nvm
# setfacl --test -dm "g:wheel:rwx" ./nvm
@rockyprabowo
rockyprabowo / list_all_exec_on_path.py
Created September 13, 2019 21:06
List all executables on PATH (cross-platform)
import os
import platform
from os.path import pathsep
from pathlib import Path
__platform = platform.system()
def list_executables():
global __platform
paths = (Path(x) for x in os.environ["PATH"].split(pathsep) if Path(x).exists())
@rockyprabowo
rockyprabowo / 99-amd-nvidia-prime-offload.conf
Last active June 14, 2023 15:47
Manjaro (or any Arch-based) AMD iGPU + Nvidia dGPU PRIME offload configuration
Section "ServerLayout"
Identifier "layout"
Option "AllowNVIDIAGPUScreens"
EndSection
Section "Device"
Identifier "AMDGPU"
Driver "amdgpu"
Option "TearFree" "true"
EndSection
polkit.addRule(function(action, subject) {
if (action.id == "org.freedesktop.policykit.exec" && action.lookup("program") == '/opt/lampp/lampp') {
return polkit.Result.YES;
}
});