Skip to content

Instantly share code, notes, and snippets.

View sheb-gregor's full-sized avatar
:shipit:
In search of rationality

Mike Sheb sheb-gregor

:shipit:
In search of rationality
View GitHub Profile
@caspg
caspg / 1_searchbar_live.ex
Last active June 21, 2024 14:23
Example of real-time search bar implementation in Phoenix LiveView and Tailwind. Working example on https://travelermap.net/parks/usa
defmodule TravelerWeb.SearchbarLive do
use TravelerWeb, :live_view
alias Phoenix.LiveView.JS
alias Traveler.Places
def mount(_params, _session, socket) do
socket = assign(socket, places: [])
{:ok, socket, layout: false}
end
@graninas
graninas / haskeller_competency_matrix.md
Last active June 30, 2024 10:13
Haskeller competency matrix
@fkurz
fkurz / manjaro-boot-drive-usb-mac.md
Last active November 22, 2023 17:38
Howto: Create a Manjaro Linux USB Boot Drive on MacOS

Create a Manjaro Linux USB Boot Drive on MacOS

  1. Download Manjaro Distribution

    Download page

  2. Format USB Drive

    To find the volume identifier of our USB stick, we run

Adopted from here https://topaxi.codes/use-npm-without-root-or-sudo-rights/

I'm saving this as a gist and modifying it to ensure that if the original blog post disappears it lives on somewhere.

Added some notes for Ubuntu 18.04 and similar.

Today we're going to setup our npm installation to be used without root or sudo rights.

By default, if you install packages globally with npm, npm tries to install them into a system directory (i.e. /usr/local/lib/node_modules). With the next steps, we're going to use your home directory for those files.

@t27
t27 / linux-oom-killer-fixes.md
Last active June 14, 2024 12:39
Dealing with the Linux OOM Killer

Dealing with the Linux OOM Killer at the program level

Do this in cases when you dont want to change the os-level settings, but only want to disable the OOM killer for a single process. This is useful when youre on a shared machine/server.

The OOM killer uses the process level metric called oom_score_adj to decide if/when to kill a process. This file is present in /proc/$pid/oom_score_adj. The oom_score_adj can vary from -1000 to 1000, by default it is 0.

You can add a large negative score to this file to reduce the probability of your process getting picked and terminated by OOM killer. When you set it to -1000, it can use 100% memory and still avoid getting terminated by OOM killer.

@CAFxX
CAFxX / golang_minimize_allocations.md
Last active June 30, 2024 17:54
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.

Protobuf

@zealot128
zealot128 / README.md
Last active July 25, 2023 19:54
Gitlab runner with docker by cloud init on Hetzner Cloud

Quick Terraform script to deploy Gitlab runner with docker onto Hetzner Cloud (Hcloud)

  1. Create other terraform stuff
  • tf-backend,
  • creds.auto.tfvars with hcloud_token
  • ssh key: mkdir keys; ssh-keygen -f id_rsa
  1. modify cloudinit.yml:
  • change gitlab url
  • ADD_YOUR_REGISTRY_TOKEN -> Set to the Gitlab Runner Registration Token
  • Add more allowed images/services, if using gitlab registry, like that: registry.myinstance.com/administrators/docker-images/*, change base image etc.
@akhenakh
akhenakh / app.yaml
Last active March 4, 2023 19:22
Example of graceful shutdown with grpc healthserver * httpserver
readinessProbe:
exec:
command: ["/root/grpc_health_probe", "-addr=:6666"]
initialDelaySeconds: 1
livenessProbe:
exec:
command: ["/root/grpc_health_probe", "-addr=:6666"]
initialDelaySeconds: 2
imagePullPolicy: IfNotPresent
@hjertnes
hjertnes / doom.txt
Created April 6, 2018 08:28
Doom Emacs Cheatsheet
SPC
SPC: find file
, switch buffer
. browse files
: MX
; EX
< switch buffer
` eval
u universal arg
x pop up scratch
@sheb-gregor
sheb-gregor / dev tips.md
Last active November 2, 2021 08:33
Usefull tips

Git

  1. Rerlace some origin:

Edit file $HOME/.gitconfig:

# Enforce SSH
[url "ssh://git@github.com/"]
  insteadOf = https://github.com/