Skip to content

Instantly share code, notes, and snippets.

View Grabber's full-sized avatar

Luiz Vitor Martinez Cardoso Grabber

View GitHub Profile
@Grabber
Grabber / OSX.md
Last active March 27, 2024 14:50
OSX: speed-up by disabling useless animations and features
defaults write -g NSScrollViewRubberbanding -int 0
defaults write com.apple.desktopservices DSDontWriteNetworkStores true
defaults write com.apple.Dock autohide-delay -float 0
defaults write com.apple.dock autohide-time-modifier -int 0
defaults write com.apple.finder DisableAllAnimations -bool true
defaults write NSGlobalDomain NSAutomaticWindowAnimationsEnabled -bool false
defaults write NSGlobalDomain NSWindowResizeTime .001
@Grabber
Grabber / main.go
Last active December 6, 2023 23:54
Golang / sync.WaitGroup / data race investigation with nested structs
package main
import (
"fmt"
"sync"
"time"
)
type Session struct {
Id string
@Grabber
Grabber / settings.json
Last active July 10, 2023 23:47
Zed Editor / settings
{
"theme": "Atelier Sulphurpool Dark",
"buffer_font_size": 12,
"hard_tabs": false,
"tab_size": 2,
"auto_update": true,
"remove_trailing_whitespace_on_save": false,
"projects_online_by_default": false,
"blinking": "off",
"format_on_save": "off",
@Grabber
Grabber / a.py
Last active June 29, 2023 19:34
virtualized list, equations and testing!
import math
import random
elt_offsets = []
elts = ['a', 'b', 'c', 'd']
m = 176
mx = 0
# pre-render, best height approximation
@Grabber
Grabber / App.jsx
Last active July 18, 2023 01:33
Experimenting React 18.2.0: Context API
import React, { useState, useReducer, useEffect, useContext } from 'react';
const Ctx = React.createContext();
const Display = () => {
return (
<Ctx.Consumer>
{ ctx => ( <span>value: {ctx.a}</span> ) }
</Ctx.Consumer>
);
@Grabber
Grabber / RUN.md
Last active October 15, 2022 00:52
bpi m2z / eth0
sudo apt-get -f install --yes
cd /tmp
chmod a+x dtc-compile.sh
./dtc-compile.sh
dtc -I dts -O dtb -o bananapi-m2-zero-eth0.dtbo bananapi-m2-zero-eth0.dts 
sudo mkdir -p /boot/overlay-user
@Grabber
Grabber / keychron_remap.md
Last active November 9, 2022 21:35
Keychron: how to remap and swap "§±" and "`~" keys on UK layout

As the Keychron K3 keyboard with UK layout has the great L-shaped ENTER key but the uncomfortable placed "§±" and "`~" keys, here is a solution to swap both keys without any third party software on OSX.

hidutil property --set '{
  "UserKeyMapping":[
    {
      "HIDKeyboardModifierMappingSrc":0x700000035,
      "HIDKeyboardModifierMappingDst":0x700000064
    },
    {
@Grabber
Grabber / vec.cpp
Last active November 13, 2021 17:20
C++: std::vector reserve
#include <vector>
#include <cstdio>
int main(int argc, char *argv[]) {
std::vector<int> x(10);
std::fprintf(stdout, "x.0: %lu\n", x.size());
x.push_back(1);
x.push_back(2);
x.push_back(3);
std::fprintf(stdout, "x.1: %lu\n", x.size());
@Grabber
Grabber / sorting.py
Last active October 8, 2021 21:20
I can't believe it can sort: is this the simplest (and most surprising) sorting algorithm ever?
import random
def icantbelieveitcansort(a: list) -> tuple:
ops = 0
for i in range(0, len(a)):
for j in range(0, len(a)):
if a[i] < a[j]:
a[i], a[j] = a[j], a[i]
ops += 1
return (a, ops)
@Grabber
Grabber / zmq.go
Last active October 8, 2021 13:37
zmq / poller / proxy
poller := zmq.NewPoller()
poller.Add(frontend, zmq.POLLIN)
poller.Add(backend, zmq.POLLIN)
for {
var sockets []zmq.Polled
sockets, err := poller.Poll(-1)
if err != nil {
break