Skip to content

Instantly share code, notes, and snippets.

View codemodify's full-sized avatar
🌴
On vacation

codemodify

🌴
On vacation
  • Planet Earth
View GitHub Profile
@codemodify
codemodify / go-crashproof-with-params.go
Created July 5, 2020 01:40
go-crashproof-with-params.go
type MyType interface {
DoSomething()
}
crashproof.GoWithArgs(func(args ...interface{}) {
if p, ok := args[0].(MyType); ok {
p.DoSomething()
}
}, myTypeInstance)
@codemodify
codemodify / go-crashproof.go
Last active July 5, 2020 01:31
go-crashproof.go
package main
import (
crashproof "github.com/codemodify/systemkit-crashproof"
)
func main() {
// 1. Catch crashes
crashproof.ConcurrentCodeCrashCatcher = reportCrash
crashproof.RunAppAndCatchCrashes(func() {
@codemodify
codemodify / go-recover-simple.go
Last active July 5, 2020 01:31
go-recover-simple.go
package main
import (
"runtime/debug"
)
func main() {
// 1. set app crash handler
defer appCrashCatcher()
@codemodify
codemodify / Thinkpad-X1-CarbonGen7.md
Created November 25, 2019 23:35
Arch Linux on Thinkpad X1 Carbon Gen 7 (i7-10710U)

Arch Linux on Thinkpad X1 Carbon Gen 7 (i7-10710U)

  • Download the latest ISO from https://www.archlinux.org/download
  • sudo dd if=archlinux-2019.11.01-x86_64.iso of=/dev/sda bs=4M status=progress oflag=sync
  • Boot the ISO
  • IF and ONLY IF you have a 4k or some HiDPI screen and fonts are super super small
    • ls /usr/share/kbd/consolefonts
    • setfont latarcyrheb-sun32
  • ls /sys/firmware/efi/efivars verifies we booted in UEFI
@codemodify
codemodify / the-cat-tree-fun.go
Created July 2, 2019 06:42
the-cat-tree-fun.go
package main
import (
"encoding/json"
"errors"
"fmt"
"log"
"strings"
)
@codemodify
codemodify / the-pizza-fun.go
Created June 26, 2019 19:27
the-pizza-fun
package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"log"
"net/http"
"sort"
)
# Do not turn off screen
sudo vi /etc/lightdm/lightdm.conf
# uncomment / add
xserver-command=X -s 0 dpms
@codemodify
codemodify / ArchLinux-Bash-Prompt.sh
Created March 30, 2019 19:00
ArchLinux-Bash-Prompt.sh
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
parse_git_branch2() { git describe --contains --all HEAD 2>/dev/null; }
PS1="\n[\u | \d \@ | \e[38;0;41m\w\e[0m \e[30;1;47m\$(parse_git_branch)\e[0m] \n-> "
@codemodify
codemodify / ArchLinux-Google-Titan-Security.sh
Created March 10, 2019 20:16
ArchLinux-Google-Titan-Security
sudo curl https://raw.githubusercontent.com/codemodify/ArchLinux-Google-Titan-Security/master/1000-u2f.rules -o /etc/udev/rules.d/1000-u2f.rules
sudo udevadm control --reload
@codemodify
codemodify / qosmicparticles-io-samples-objc.c
Created January 17, 2019 12:02
qosmicparticles-io-samples-objc.c
#import <Foundation/Foundation.h>
NSDictionary *headers = @{ @"Content-Type": @"application/json" };
NSDictionary *parameters = @{ @"version": @"2.0",
@"key": @"rcd1JN+CkZo2+KKR802bXTujubMbiZARQcyTR8Ku8haqdyaz8pA8Z1kbrWJO2J2CiwFdnr",
@"gobSize": @10 };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];