Skip to content

Instantly share code, notes, and snippets.

View yurrriq's full-sized avatar
🙈
I may be slow to respond.

Eric Bailey yurrriq

🙈
I may be slow to respond.
View GitHub Profile
@yurrriq
yurrriq / ipconfig.sh
Last active February 10, 2024 14:34
Get Public IP Address in Terminal
#!/bin/bash
# Slow
curl -s ifconfig.me | xargs echo -n
# Faster
curl -s icanhazip.com | xargs echo -n
# API: http://api.ident.me
@yurrriq
yurrriq / wtf.sh
Created November 29, 2023 18:23
Stop GNOME from eating C-;
# https://superuser.com/a/1687344
λ gsettings get org.freedesktop.ibus.panel.emoji hotkey
['<Control>period', '<Control>semicolon']
λ gsettings set org.freedesktop.ibus.panel.emoji hotkey "@as ['<Control>period']"
λ gsettings get org.freedesktop.ibus.panel.emoji hotkey
['<Control>period']
;;; go-template-mode.el --- Major mode for Go template language
;;; Commentary:
;; 1) Copy this file somewhere in your Emacs `load-path'. To see what
;; your `load-path' is, run inside emacs: C-h v load-path<RET>
;;
;; 2) Add the following to your .emacs file:
;;
;; (require 'go-template-mode)
@yurrriq
yurrriq / thoughts.md
Created November 15, 2022 21:25 — forked from tazjin/thoughts.md
Nix builder for Kubernetes
@yurrriq
yurrriq / eio.el
Created June 4, 2017 18:02 — forked from canweriotnow/eio.el
elisp exercise helper
;;; eio.el --- Support for creating Elisp exercises
;; Author: Jason Lewis
;; Created: 5 June 2015
;; This file is not part of GNU Emacs.
;;; Commentary:
;;
;; Provides utility functions for stubbing elisp exercises
@yurrriq
yurrriq / nix_antiquotation.md
Created March 6, 2017 09:19
Nix Antiquotation notes

Antiquotation (${expr}) is supported in indented strings.

Since ${ and '' have special meaning in indented strings, you need a way to quote them. ${ can be escaped by prefixing it with '' (that is, two single quotes), i.e., ''${. '' can be escaped by prefixing it with ', i.e., '''. Finally, linefeed, carriage-return and tab characters can be written as ''\n, ''\r, ''\t.

https://nixos.org/nix/manual/#idm140737318143872

@yurrriq
yurrriq / CGRect+Subract.swift
Created May 5, 2017 18:07
Subtract a CGRect from another
import CoreGraphics
public extension CGRect {
func subtract(_ subtrahend: CGRect, edge: CGRectEdge) -> CGRect {
guard intersects(subtrahend) else { return self }
let intersectSize: CGSize = intersection(subtrahend).size
let distance: CGFloat = (edge == .minXEdge || edge == .maxXEdge)
@yurrriq
yurrriq / openconnect_wrapper
Created April 25, 2019 02:00 — forked from ashgillman/openconnect_wrapper
openconnect launchd
#!/bin/bash
# /etc/openconnect_wrapper
# swap out SIGTERM for openconnect-friendly SIGINT
_term() {
kill -INT "$child" 2>/dev/null
}
trap _term SIGTERM
@yurrriq
yurrriq / wiki.lua
Created April 10, 2019 15:19 — forked from zhzhxtrrk/wiki.lua
pandoc confluence markup writer
-- that is very similar to that of pandoc's HTML writer.
-- There is one new feature: code blocks marked with class 'dot'
-- are piped through graphviz and images are included in the HTML
-- output using 'data:' URLs.
--
-- Invoke with: pandoc -t sample.lua
--
-- Note: you need not have lua installed on your system to use this
-- custom writer. However, if you do have lua installed, you can
-- use it to test changes to the script. 'lua sample.lua' will
@yurrriq
yurrriq / extract_kubecfg_cert.sh
Created May 7, 2018 20:34 — forked from xueshanf/extract_kubecfg_cert.sh
Extract kubernetes cluster credentials from kubecfg
#!/bin/bash
# Input: ./extract_kubecfg_cert.sh my-cluster-name username
# Output: ./my-cluster-name-ca.crt ./username.crt ./username.key
# Exit on error
abort(){
echo $1 && exit 1
}
# Prerequistes