Skip to content

Instantly share code, notes, and snippets.

View slash3b's full-sized avatar

ilya slash3b

View GitHub Profile
@slash3b
slash3b / 32.asm
Created January 3, 2025 14:13 — forked from FiloSottile/32.asm
NASM Hello World for x86 and x86_64 Intel Mac OS X (get yourself an updated nasm with brew)
; /usr/local/bin/nasm -f macho 32.asm && ld -macosx_version_min 10.7.0 -o 32 32.o && ./32
global start
section .text
start:
push dword msg.len
push dword msg
push dword 1
mov eax, 4
@slash3b
slash3b / slices.go
Created April 26, 2024 10:21
Go slices mind-twister
firstSlice := []string{"a", "b", "c", "d", "e", "f"}
firstSlice = firstSlice[:5]
secondSlice := firstSlice
firstSlice = append(firstSlice, "g")
// This will print: [a b c d e g]
fmt.Println(firstSlice)
secondSlice = append(secondSlice, "h")
@slash3b
slash3b / firefox_tree_tab_setup.md
Last active November 28, 2023 21:52
Tree Style Tab addon setup on Firefox 119.0.1, NixOS

source: https://www.pcworld.com/article/823939/vertical-tabs-in-firefox-yes-its-really-possible.html

  • open about:config in Firefox tab
  • in the search find toolkit.legacyUserProfileCustomizations.stylesheets and toggle value to true
  • open about:support
  • scroll down to the section that says “Profile Folder,” and click the “Open Folder” button
  • Create a new subfolder called chrome within the folder you just opened
  • in the new chrome folder, create a new text file userChrome.css
  • paste inside css file content from below, save and restart Firefox. Voila! It should work.
    userChrome.css, source: https://raw.githubusercontent.com/OneJaredNewman/firefoxcss/main/userChrome.css
@slash3b
slash3b / note.md
Created September 3, 2023 09:58 — forked from wheeskers/note.md
Disable wakeup for device using systemd

Check devices

# cat /proc/acpi/wakeup

Find specific devices

Examples:

@slash3b
slash3b / _roles.txt
Created June 23, 2022 14:00 — forked from lizthegrey/_roles.txt
Lizzes' hardware
lily: main amd64 workstation used primarily for gaming, secondarily for work
daisy: main arm64 workstation used primarily for work
foxglove: secondary amd64 workstation used for recording videos, streams, podcasts, etc. in a soundproof booth -- or for quiet focus time
@slash3b
slash3b / locale.php
Created May 4, 2017 19:21
PHP time considering locale
latitude:untitled1 $ php -a
Failed loading /usr/lib64/php/modules/xdebug.so: /usr/lib64/php/modules/xdebug.so: cannot open shared object file: No such file or directory
Interactive shell
php > setlocale(LC_TIME, 'nl_NL');
php >
php > /* Output: vrijdag 22 december 1978 */
php > echo strftime("%A %e %B %Y", mktime(0, 0, 0, 12, 22, 1978));
vrijdag 22 december 1978
php > echo strftime("%A %e %B %Y" );
@slash3b
slash3b / tmuxlaunch.sh
Created April 27, 2017 07:46
Really easy way to automate the workflow
SESSION=dev
# create new session in detached mode
tmux new-session -d -s $SESSION
tmux new-window -t $SESSION:1 -n 'P1-env'
tmux select-window -t $SESSION:1
# C-m sends Enter to the terminal
tmux send-keys 'cd Projects' C-m
tmux send-keys 'cd environment' C-m
tmux send-keys './dev up -d' C-m
@slash3b
slash3b / fibonacci.go
Created April 16, 2017 17:08
fibonacci in go with closure
package main
import "fmt"
// fibonacci is a function that returns
// a function that returns an int.
func fibonacci() func() int {
nums := []int{0, 0}
return func() int {
@slash3b
slash3b / update
Created February 9, 2017 14:50
update environment
echo -e "\033[1;41mIf you are on VPN do not forget to switch it off!\033[0m"
# CONFIG PATHS
projects_folder="/home/slash3b/Projects/all"
env_folder="/home/slash3b/Projects/environment"
projects_branch="develop"
env_branch="2.0.x"
cd $projects_folder
for project in $(ls $projects_folder)
@slash3b
slash3b / query
Created December 27, 2016 18:26
mongo double grouping example
db.getCollection("Transaction").aggregate([
{$match: {paymentId: {$exists: true}}},
{$group: {_id: "$paymentId", id: {$addToSet: "$_id"}, amount: {$addToSet: "$amount"}, user: {$addToSet: "$user"}, count: {$sum: 1}}},
{$match: {count: {$gt: 1}}},
{$group: {_id: "$user", compound: {
$addToSet: {
"transactionIds":"$id",
"amount": "$amount"
}
}}}