Skip to content

Instantly share code, notes, and snippets.

View ariefrahmansyah's full-sized avatar
🇵🇸

Arief Rahmansyah ariefrahmansyah

🇵🇸
View GitHub Profile
@brianspiering
brianspiering / install_pyspark_on_m1_mac.md
Created February 24, 2022 20:58
Installation guide to pyspark on M1 Mac

Install Spark

Run all of these commands at the command line (not in a Jupyter Notebook). The command line will have more informative error messages and if we need complete additional steps, we'll get the messages.

Spark is a framework within the Scala programming language. Scala uses the JVM (Java Virtual Machine) so you'll need install Java.

If you use homebrew:

@mxk
mxk / protoc.go
Created August 27, 2019 15:21
TensorFlow Serving gRPC interface generator for Go
//+build ignore
// TensorFlow Serving gRPC interface generator.
//
// This script works around a bunch of issues (as of 2019-08-25) between Go's
// protobuf compiler plugin, Go modules, and definitions of TensorFlow and
// TensorFlow Serving proto files. It assumes that protoc and protoc-gen-go are
// on your PATH.
//
// git clone -b r1.15 https://github.com/tensorflow/tensorflow.git
@rdyv
rdyv / print-memory.go
Created May 22, 2019 20:54
Go print current memory
package main
import (
"runtime"
"fmt"
"time"
)
func main() {
// Print our starting memory usage (should be around 0mb)
@CAFxX
CAFxX / golang_minimize_allocations.md
Last active May 6, 2025 18:18
Minimize allocations in Go

📂 Minimize allocations in Go

A collection of tips for when you need to minimize the number of allocations in your Go programs.

Use the go profiler to identify which parts of your program are responsible for most allocations.

⚠️ Never apply these tricks blindly (i.e. without measuring the actual performance benefit/impact). ⚠️

Most of these tricks cause a tradeoff between reducing memory allocations and other aspects (including e.g. higher peak memory usage, higher CPU usage, lower maintainability, higher probability of introducing subtle bugs). Only apply these tricks if the tradeoff in every specfic case is globally positive.

@milesbxf
milesbxf / monzo-alertmanager-config.yaml
Last active April 16, 2025 20:12
Monzo's Alertmanager Slack templates
###################################################
##
## Alertmanager YAML configuration for routing.
##
## Will route alerts with a code_owner label to the slack-code-owners receiver
## configured above, but will continue processing them to send to both a
## central Slack channel (slack-monitoring) and PagerDuty receivers
## (pd-warning and pd-critical)
##
@brandon1024
brandon1024 / BatteryStatusNotification.scpt
Last active October 5, 2024 04:07
Battery Percentage Boundary Notification Background Script for macOS
repeat
set chargeState to do shell script "pmset -g batt | awk '{printf \"%s %s\\n\", $4,$5;exit}'"
set percentLeft to do shell script "pmset -g batt | egrep -ow '([0-9]{1,3})[%]' | egrep -ow '[0-9]{1,3}'"
considering numeric strings
if chargeState contains "Battery Power" and percentLeft ≤ 40 then
display notification "Time to plug me in :)" with title "Battery Charge Boundary"
else if chargeState contains "AC Power" and percentLeft ≥ 80 then
display notification "Time to unplug me :)" with title "Battery Charge Boundary"
end if
end considering
@rubencaro
rubencaro / setup_go.md
Last active April 28, 2024 21:52
Golang installation guide

Golang installation guide

Since Golang version 1.11 this process is finally (almost) as easy as it should (!!). You can see full docs here. For older guides see here.

These are my notes, not a generic solution. They are not meant to work anywhere outside my machines. Update version numbers to whatever are the current ones while you do this.

Installing everything needed the first time

Install asdf and its golang plugin, then install golang

@subfuzion
subfuzion / curl.md
Last active May 21, 2025 09:15
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.