Skip to content

Instantly share code, notes, and snippets.

## Provides utility methods to make working with bit manipulations
## easier and less error prone
const
validBitfieldType = ["int", "int8", "int16", "int32", "int64", "uint",
"uint8", "uint16", "uint32", "uint64", "bool"]
macro bitfield(values: varargs[stmt]): stmt =
## Creates a bitfield with the given fields
# Validate and initial parameter processing
if values.len %% 3 != 0:
error("Each field requires three values")
Name Ownership Copyable Movable Sharing Lifetime Semantics
unique_ptr Unique Lexical Reference
shared_ptr Shared Reference Reference-counted Reference
weak_ptr Non-extending Optional-reference
value_ptr Unique Value Lexical Value
@swannodette
swannodette / gist:997140
Created May 28, 2011 19:26
type-inf.clj
(ns logic.y
(:refer-clojure :exclude [== reify inc])
(:use [clojure.core.logic minikanren prelude
nonrel match]))
(defna findo [x l o]
([_ [[?y :- o] . _] _]
(project [x ?y] (== (= x ?y) true)))
([_ [_ . ?c] _] (findo x ?c o)))
@eirikb
eirikb / clicktest.md
Last active April 9, 2021 16:49
Automated click testing in bash

About

This is a bash script, as an example, on how to do click-testing GUI based on finding components based on how they look.

Dependencies

@jneen
jneen / audio.sh
Created April 16, 2020 17:58
THE ONE TRUE SETUP
#!/bin/bash
export AUDIO_DEFAULT_CAPTURE=hw:PCH
export AUDIO_DEFAULT_PLAYBACK=hw:PCH
execd() {
echo "$@" >&2
"$@"
}
@ivan4th
ivan4th / 1password.lisp
Created June 24, 2022 23:37
Inecobank scraping
(in-package :yobabank)
(defparameter *1pw-secure-note-name* "Yobabank Data")
(defparameter *1pw-vault* "Personal")
(defun 1pw-get-field (object name)
(when (typep object 'st-json:jso)
(st-json:getjso name object)))
(defun 1pw-get-id (object)
import macros
proc procToLambda(input: PNimrodNode): PNimrodNode {.compiletime.} =
# Ident !"foo"
# Empty
# Empty
# FormalParams
# Ident retType
# IdentDefs
# ...
/*!
* jQuery JavaScript Library v2.1.1pre
* http://jquery.com/
*
* Includes Sizzle.js
* http://sizzlejs.com/
*
* Copyright 2005, 2014 jQuery Foundation, Inc. and other contributors
* Released under the MIT license
* http://jquery.org/license
@swannodette
swannodette / gist:3217582
Created July 31, 2012 14:52
sudoku_compact.clj
;; based on core.logic 0.8-alpha2 or core.logic master branch
(ns sudoku
(:refer-clojure :exclude [==])
(:use clojure.core.logic))
(defn get-square [rows x y]
(for [x (range x (+ x 3))
y (range y (+ y 3))]
(get-in rows [x y])))
@kristianlm
kristianlm / Chipmunk.mk
Created May 7, 2012 15:56
Building Chipmunk for Android: An Android NDK module for Chipmunk Physics Engine
# This makefile will let the Android NDK build a
# libchipmunk.so to go with your 2D Android game.
# download the Chipmunk sources and do
# $ cd <chipmunk-physics>
# $ git checkout Chipmunk-6.0.3 # if you downloaded from source
# $ mkdir -p modules/chipmunk && cd modules/chipmunk
# $ cat >Android.mk <<EOF
LOCAL_HOME := $(dir $(lastword $(MAKEFILE_LIST)))