Skip to content

Instantly share code, notes, and snippets.

View lionello's full-sized avatar
🇭🇰

Lio李歐 lionello

🇭🇰
View GitHub Profile
@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 '-' '.')
@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>

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.

@cowlicks
cowlicks / Dockerfile
Last active September 11, 2023 19:23
Safely share your SSH access while building a Dockerfile using socat to forward ssh-agent's SSH_AUTH_SOCK
FROM python:3-stretch
COPY . /app
WORKDIR /app
RUN mkdir -p /tmp
# install socat and ssh to talk to the host ssh-agent
RUN apt-get update && apt-get install git socat openssh-client \
# create variable called SSH_AUTH_SOCK, ssh will use this automatically
@lionello
lionello / .direnvrc
Last active August 6, 2019 08:37 — forked from adisbladis/.direnvrc
Direnv nix cache. Put this file in your HOME folder.
#!/bin/bash
#
# Cache nix-shell environment
#
# - watches shell.nix (or default.nix), ~/.direnvrc and .envrc
# - based on https://github.com/direnv/direnv/wiki/Nix
#
use_nix() {
local shell_file=$(test -f shell.nix && echo shell.nix || echo default.nix)
if [[ ! -f "$shell_file" ]]; then return; fi
@sveitser
sveitser / Entropy.ipynb
Last active September 7, 2018 08:00
Was wondering about entropy of pass phrases.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
{ pkgs ? import <nixpkgs> {} }:
let
inherit (pkgs) lib stdenv ruby_2_3 rake bundler bundlerEnv openssl defaultGemConfig;
rubyEnv = bundlerEnv {
name = "mezzo";
ruby = ruby_2_3;
gemdir = ./.;
@adisbladis
adisbladis / .direnvrc
Created June 6, 2018 09:44
direnvrc nix cache
use_nix() {
local shell_file=$(test -f shell.nix && echo shell.nix || echo default.nix)
local cache_key=$(nix-instantiate "$shell_file" 2> /dev/null | shasum -a 1 | cut -d ' ' -f 1)
# Use ram as virtualenv storage
local tmpdir
case $(uname -s) in
Linux*) tmpdir=$XDG_RUNTIME_DIR;;
Darwin*) tmpdir_SDK=$TMPDIR;;
*) tmpdir=/tmp
@marceloalmeida
marceloalmeida / .gitattributes
Last active December 7, 2023 14:26
How to show diffs for gpg-encrypted files?
*.gpg filter=gpg diff=gpg
*.asc filter=gpg diff=gpg
@asukakenji
asukakenji / 0-go-os-arch.md
Last active April 24, 2024 06:51
Go (Golang) GOOS and GOARCH

Go (Golang) GOOS and GOARCH

All of the following information is based on go version go1.17.1 darwin/amd64.

GOOS Values

GOOS Out of the Box
aix
android