Skip to content

Instantly share code, notes, and snippets.

View 42atomys's full-sized avatar
🚀
Launch new project

Atomys 42atomys

🚀
Launch new project
View GitHub Profile

Keybase proof

I hereby claim:

  • I am 42Atomys on github.
  • I am atomys (https://keybase.io/atomys) on keybase.
  • I have a public key whose fingerprint is 506A 8157 435D 43F0 3EDF 4101 045D A7C5 3DE9 0663

To claim this, I am signing this object:

#!/bin/bash
# Used to update Factorio servers located on INSTALL_PATH
# to latest version of servers.
# Your server installations needs to follow the headless architecture "INSTALL_PATH/$name/factorio/{bin,config,...}"
# To work correctly this script want to found a systemctl service attached to your install location
# to restart the server.
# WARNING: No backup is done during this update.
export INSTALL_PATH="/home/factorio"
export LATEST_URL="https://factorio.com/get-download/latest/headless/linux64"
@42atomys
42atomys / Makefile
Created April 21, 2021 09:16
Makefile for install protoc-gen dependencies
all: proto-deps proto-build
proto-deps:
@ if ! which protoc > /dev/null; then \
echo "error: protoc not installed" >&2; \
exit 1; \
fi
go mod tidy
go install \
github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway \
#!/bin/bash
mkdir -p {api,build/{ci,package},cmd,configs,deployements,docs,examples,githooks,pkg,internal/{app,pkg},scripts,tests,tools,web,website}
@42atomys
42atomys / git_alias_sugar.sh
Created August 26, 2022 15:52
Git alias sugar
git config --system alias.fetch-clean "\!f() { git branch --v | grep '\[gone\]' | awk '{print $1}' | xargs git branch -D; }; f"
git config --system alias.amend-to '!f() { SHA=`git rev-parse "$1"`; git commit --fixup "$SHA" && GIT_SEQUENCE_EDITOR=true git rebase --interactive --autosquash "$SHA^"; }; f'
@42atomys
42atomys / ip_version.go
Created September 17, 2024 13:34
[Go brain breaker for everyone] Do a IP Version validator only in bitwise
package main
// IPVersion return the version of an IP (4 or 6) only by using bitwise with zero allocation.
// This implementation are 17.6% faster than no bitwise implementation but create an unreadable
// code. I challenge myself to create that only for fun. That's fun, and I wanna to store and share
// somewhere so that is it !
func IPVersion(ipStr string) (int, error) {
var flags uint8 = 0
for i := 0; i < len(ipStr); i++ {
c := ipStr[i]