Skip to content

Instantly share code, notes, and snippets.

View djblue's full-sized avatar

Chris Badahdah djblue

View GitHub Profile
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active May 1, 2024 03:34
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@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
@chrisroos
chrisroos / gpg-import-and-export-instructions.md
Created September 9, 2011 10:49
Instructions for exporting/importing (backup/restore) GPG keys

Every so often I have to restore my gpg keys and I'm never sure how best to do it. So, I've spent some time playing around with the various ways to export/import (backup/restore) keys.

Method 1

Backup the public and secret keyrings and trust database

cp ~/.gnupg/pubring.gpg /path/to/backups/
cp ~/.gnupg/secring.gpg /path/to/backups/
cp ~/.gnupg/trustdb.gpg /path/to/backups/

or, instead of backing up trustdb...

@buren
buren / cross-origin-local-storage.js
Created November 1, 2017 10:21
Cross origin local storage sharing example (using an iframe and postMessage)
const CrossOriginLocalStorage = function(currentWindow, iframe, allowedOrigins, onMessage) {
this.allowedOrigins = allowedOrigins;
let childWindow;
// some browser (don't remember which one) throw exception when you try to access
// contentWindow for the first time, it works when you do that second time
try {
childWindow = iframe.contentWindow;
} catch(e) {
childWindow = iframe.contentWindow;

How Clojure's documentation can leapfrog other languages

Summary

I made a documentation generator that cashes in on Clojure's dynamism. See the play-cljs docs (a ClojureScript game library) for an example of its output.

The Problem

Like many of you, I've often wondered what my final regret will be on my deathbed. My best guess came to me in a dream recently. I was walking across the charred earth of an apocalyptic future world, maneuvering around the remains of the less fortunate. I was startled to find a young girl, barely holding onto her life. She murmured something to me. I asked her to repeat it, and she said more loudly: "I...wish your Clojure projects didn't have such crappy documentation."

@ericnormand
ericnormand / 00_script.clj
Last active January 6, 2024 07:13
Boilerplate for running Clojure as a shebang script
#!/bin/sh
#_(
#_DEPS is same format as deps.edn. Multiline is okay.
DEPS='
{:deps {clj-time {:mvn/version "0.14.2"}}}
'
#_You can put other options here
OPTS='
@kirbyUK
kirbyUK / 6502_instructions.json
Created October 17, 2017 15:24
6502 instruction set in JSON
[
{
"bytes" : "2",
"description" : "Add with Carry",
"name" : "ADC",
"opcode" : "$69",
"mode" : "Immediate"
},
{
"opcode" : "$65",
@Yogsther
Yogsther / hbomax_ultrawide.json
Created January 25, 2022 20:42
21:9 support for HBO MAX (Ultrawide aspect ratio)
{"userCSSoptions":{"theme":"default","font":"font%3A%2016px%2F20px%20monospace","width":"400","height":"300","dock":"right","opacity":"100"},"userCSSstyles":[{"site":"play.hbomax.com","styles":"video{\n height: calc(100vh * 1.238) !important;\n top: calc(-100vh * 0.238/2) !important;\n}","toggle":1}]}
@yogthos
yogthos / core.cljs
Last active March 13, 2023 19:19
Gjs ClojureScript example
(ns gjs-example.core)
(defn main []
(set! (-> js/imports .-gi .-versions .-Gtk) "3.0")
(let [Gtk (doto (-> js/imports .-gi .-Gtk) (.init nil))
window (Gtk.Window.
(clj->js
{:type (-> Gtk .-WindowType .-TOPLEVEL)
:title "A default title"
:default_width 300
@borkdude
borkdude / find-var.clj
Last active January 20, 2023 09:13
Babashka script to find var usages in current project
#!/usr/bin/env bb
;; usage:
;; $ find-var.clj babashka.main/main src:test
;; example output:
;; src/babashka/main.clj:672:32
;; src/babashka/main.clj:673:22
;; src/babashka/main.clj:676:28
;; test/babashka/test_utils.clj:31:59