Skip to content

Instantly share code, notes, and snippets.

View lionello's full-sized avatar
🇭🇰

Lio李歐 lionello

🇭🇰
View GitHub Profile

fix function - https://github.com/NixOS/nixpkgs/blob/9f087964709174424bca681b600af8ee8e763df5/lib/fixed-points.nix#L19 , https://en.m.wikipedia.org/wiki/Fixed_point_(mathematics) , point where x = f(x) = f(f(f(f....f(x)....)))

rec { a = 1; b = a + 1; } is the same as fix (self: { a = 1; b = self.a + 1; })

builtins.trace - https://github.com/NixOS/nixpkgs/blob/9f087964709174424bca681b600af8ee8e763df5/lib/debug.nix#L4 trace has different flavors, http://hackage.haskell.org/package/base-4.12.0.0/docs/Debug-Trace.html#v:trace all lazy languages have trace

builtins.seq - in lazy languages data is represented as thunks (IF data has not been yet evaluated THEN it's pointer on function that should produce this data ELSE it's pointer on data), builtins.seq forces first layer of data to evaluate (evaluates it to WHNF?), builtins.deepSeq is recursive variant of seq, it forces whole data to evaluate (evaluates it to NF?), (more https://wiki.haskell.org/Seq, https://www.google.com/amp/s/amp.reddit.

@harunpehlivan
harunpehlivan / index.html
Created August 17, 2019 10:35
Social Media Color Hex Codes
<div class="SocialMediaColors">
<div class="facebook-color fa fa-facebook"><span><br>Facebook<br>Hex: #3b5998</span></div>
<div class="twitter-color fa fa-twitter"><span><br>Twitter<br>Hex: #00aced</span></div>
<div class="GooglePlus-color fa fa-google-plus"><span><br>Google +<br>Hex: #dd4b39</span></div>
<div class="pinterest-color fa fa-pinterest"><span><br>Pinterest<br>Hex: #cb2027</span></div>
<div class="linkedin-color fa fa-linkedin"><span><br>Linkedin<br>Hex: #007bb6</span></div>
@cumet04
cumet04 / ec2-k3s-install-script.sh
Created August 17, 2019 14:57
k3s cloudinit script
#!/bin/bash
K3S_VERSION=v0.8.0
BIN_DIR=/usr/local/bin
# for master
#cat > /opt/k3s_env_put.sh << 'EOF'
##!/bin/bash
#
#ip=$(hostname | cut -d'.' -f1 | cut -d'-' -f2,3,4,5 | tr '-' '.')
@blixt
blixt / OculusQuestCloudGaming.md
Last active February 29, 2024 17:07
Playing SteamVR games on the Oculus Quest

Playing SteamVR games on the Oculus Quest, without owning a PC

Setting up your Virtual Machine

We'll be creating a new Virtual Machine on Microsoft's cloud platform, Azure. The VM will have a beefy GPU just like a home computer so it can be used for playing games.

  1. Go to [the Azure portal][azure] and sign up or log in.
  2. If you are on a Free account, first go to Subscriptions and upgrade it to a Pay-as-you-go plan. Don't worry, you will get to keep any free credits you have. Azure's interface is a bit slow so this will take a minute.

⚠️ Make sure to not include any support plan because they will charge you monthly!

@dvf
dvf / change-codec.md
Last active June 6, 2024 12:30
Enable High Quality mode on your headphones (Updated for macOS Catalina)

If you're using a high-end bluetooth headset on your Macbook Pro it's likely your mac is using an audio codec which favors battery efficiency over high quality. This results in a drastic degradation of sound, the SBC codec is the likely culprit, read more about it here.

Find out what codec you're using

  1. Play a song on your headphones
  2. Option (⌥) click the Bluetooth button at the top of your screen Inspect the Bluetooth Coded
  3. If you're using AAC or aptX, you can stop here—those are the highest quality codecs.

Change your codec to AAC or aptX

@superseb
superseb / k3s-etcd-commands.md
Last active June 5, 2024 20:52
k3s etcd commands

k3s etcd commands

etcd

Setup etcdctl using the instructions at https://github.com/etcd-io/etcd/releases/tag/v3.4.13 (changed path to /usr/local/bin):

Note: if you want to match th etcdctl binaries with the embedded k3s etcd version, please run the curl command for getting the version first and adjust ETCD_VER below accordingly:

curl -L --cacert /var/lib/rancher/k3s/server/tls/etcd/server-ca.crt --cert /var/lib/rancher/k3s/server/tls/etcd/server-client.crt --key /var/lib/rancher/k3s/server/tls/etcd/server-client.key https://127.0.0.1:2379/version
@aheissenberger
aheissenberger / timemachine.sh
Last active September 30, 2023 10:19
Exclude package folder e.g. node_modules from being backuped by MacOS Time Machine
#!/bin/sh
#set -x
EXCLUDEFOLDERNAME=${3:-"node_modules"}
get_realpath ()
{
echo "$(cd "$(dirname "$1")"; pwd)/$(basename "$1")"
}
SEARCHPATH="$(get_realpath ${2:-"${HOME}"})"
@yankcrime
yankcrime / k3s-aws-cloud-provider.md
Last active June 19, 2023 18:33
Auto-deploying the external AWS Cloud Provider when bootstrapping K3s

Installing K3s with the external ("out-of-tree") AWS Cloud Provider

Pre-requisites

Refer to the upstream project's official documentation for the various pre-requisites. You must have an IAM role with the right permissions attached to your K3s instances, and you must also tag your nodes with a clusterid. Refer to the Rancher documentation for how to do this

Install K3s with the following options:

curl -sfL https://get.k3s.io | INSTALL_K3S_EXEC="server \
@piperswe
piperswe / build_push_and_run.sh
Created April 17, 2021 01:53
Build multi-architecture Docker images with Nix
#!/bin/sh
# Required on macOS because cctools is marked as broken
export NIXPKGS_ALLOW_BROKEN=1
nix run -f image.nix -c push
docker run ghcr.io/piperswe/hello