Skip to content

Instantly share code, notes, and snippets.

@ahungry
ahungry / janet.ctags
Created Apr 22, 2020 — forked from sogaiu/janet.ctags
~/.ctags.d/janet.ctags -- for indexing top-level things in janet code -- usage: `ctags -R <dir>` or for emacs, `ctags -e -R <dir>` -- sorry, no destructuring support
View janet.ctags
--exclude=.git
--langdef=Janet
--langmap=Janet:.janet
--regex-janet=/^\([ \t]*def[ \t]+([^0-9:#][^ \t\[{(]+)/\1/D,def/
--regex-janet=/^\([ \t]*def-[ \t]+([^0-9:#][^ \t\[{(]+)/\1/d,private def/
--regex-janet=/^\([ \t]*defglobal[ \t]+([^0-9:#][^ \t\[{(]+)/\1/g,defglobal/
--regex-janet=/^\([ \t]*defmacro[ \t]+([^0-9:#][^ \t\[{(]+)/\1/M,macro/
--regex-janet=/^\([ \t]*defmacro-[ \t]+([^0-9:#][^ \t\[{(]+)/\1/m,private macro/
--regex-janet=/^\([ \t]*defn[ \t]+([^0-9:#][^ \t\[{(]+)/\1/N,function/
--regex-janet=/^\([ \t]*defn-[ \t]+([^0-9:#][^ \t\[{(]+)/\1/n,private function/
View deploy_minikube.sh
#!/bin/sh
# install needed curl package
sudo apt install --no-install-recommends curl -y
# install kubectl
# https://github.com/kubernetes/minikube/issues/3437#issuecomment-449408316, maybe use https://storage.googleapis.com/minikube/releases/v0.30.0/docker-machine-driver-kvm2
curl -Lo /tmp/kubectl https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl && \
chmod +x /tmp/kubectl && \
sudo mv /tmp/kubectl /usr/local/bin/kubectl
# kubectl tab completion
sudo sh -c 'echo "source <(kubectl completion bash)" > /etc/bash_completion.d/kubectl'
@ahungry
ahungry / arch-linux-install-encryption
Created Jun 27, 2019 — forked from dust321/arch-linux-install-encryption
Minimal instructions for installing Arch Linux on an DOS/BIOS system with full system encryption using dm-crypt and luks
View arch-linux-install-encryption
# Install ARCH Linux with encrypted file-system, for BIOS. Dustin dut n ex 5 a t g ma il
# The official installation guide (https://wiki.archlinux.org/index.php/Installation_Guide) contains a more verbose description.
# Download the archiso image from https://www.archlinux.org/
# Copy to a usb-drive
dd if=archlinux.img of=/dev/sdX # on linux
# Boot from the usb. If the usb fails to boot, make sure that secure boot is disabled in the BIOS configuration.
@ahungry
ahungry / arch-linux-install
Created Jun 27, 2019 — forked from mattiaslundberg/arch-linux-install
Minimal instructions for installing arch linux on an UEFI system with full system encryption using dm-crypt and luks
View arch-linux-install
# Install ARCH Linux with encrypted file-system and UEFI
# The official installation guide (https://wiki.archlinux.org/index.php/Installation_Guide) contains a more verbose description.
# Download the archiso image from https://www.archlinux.org/
# Copy to a usb-drive
dd if=archlinux.img of=/dev/sdX bs=16M && sync # on linux
# Boot from the usb. If the usb fails to boot, make sure that secure boot is disabled in the BIOS configuration.
# Set swedish keymap
View gist:0199e46c7b5a3b36aa8b55227037e347
cat /etc/systemd/system/backlight.service
[Unit]
Description=Fix the laptop backlight
[Service]
ExecStart=/usr/local/bin/brightfix.sh
[Install]
WantedBy=multi-user.target
View etter.el
# -*- mode: snippet -*-
# name: typed getter/setter/property of class
# key: tetter
# --
/** @var $2 */
private $$1;
/**
* @return $2 Return the set value
*/
View Get-TLS-Fingerprint.sh
#!/bin/bash
##
## A simple little shell script that will return the current
## fingerprint on the SSL certificate. It's crude but works :D
##
## Author: Bob Saska (r35krag0th) <git@r35.net>
openssl s_client -connect tuner.pandora.com:443 < /dev/null 2> /dev/null | \
openssl x509 -noout -fingerprint | tr -d ':' | cut -d'=' -f2
@ahungry
ahungry / stumpwmrc.lisp
Created Jun 2, 2016
send in special unicode chars np
View stumpwmrc.lisp
(defcommand wss (string) ()
"Send a string of characters, including non-ascii ones (needs work for more than 1 char at a time)"
(map nil (lambda (ch)
(let* ((char-code (char-code ch))
(keysym (+ char-code (if (>= char-code #x100) #x01000000 0)))) ;; Only applicable if code >= #x100
(xlib:change-keyboard-mapping
*display*
(make-array '(1 1) :initial-element keysym)
;;#2A(
;;#(16778171) ;; λ in slot 8
@ahungry
ahungry / _reader-macros.md
Created May 19, 2016 — forked from chaitanyagupta/_reader-macros.md
Reader Macros in Common Lisp
View _reader-macros.md

Reader Macros in Common Lisp

This post also appears on lisper.in.

Reader macros are perhaps not as famous as ordinary macros. While macros are a great way to create your own DSL, reader macros provide even greater flexibility by allowing you to create entirely new syntax on top of Lisp.

Paul Graham explains them very well in [On Lisp][] (Chapter 17, Read-Macros):

The three big moments in a Lisp expression's life are read-time, compile-time, and runtime. Functions are in control at runtime. Macros give us a chance to perform transformations on programs at compile-time. ...read-macros... do their work at read-time.

@ahungry
ahungry / post.php
Created Jan 23, 2016
Safely get post data or defaults
View post.php
<?php
function post($key, $default = '')
{
return isset($_POST[$key]) ? $_POST[$key] : $default;
}
$name = post('name', 'Jon Smith');