Skip to content

Instantly share code, notes, and snippets.

@SkyWriter
SkyWriter / reframe_datascript.cljs
Created June 4, 2025 13:06
An excerpt to use Datascript as Re-Frame database (circa 2015)
(ns theatralia.thomsky
(:require [datascript :as d]
datascript.core
[cljs-uuid-utils.core :as uuid]
[re-frame.core :as rf]
[re-frame.handlers :as handlers]
[re-frame.middleware :as middleware]
[plumbing.core :refer [safe-get]]
[reagent.core :as reagent]))
@SkyWriter
SkyWriter / reagent_datascript.cljs
Created June 4, 2025 13:03 — forked from allgress/reagent_datascript.cljs
Test use of DataScript for state management of Reagent views.
(ns reagent-test.core
(:require [reagent.core :as reagent :refer [atom]]
[datascript :as d]
[cljs-uuid-utils :as uuid]))
(enable-console-print!)
(defn bind
([conn q]
(bind conn q (atom nil)))
@SkyWriter
SkyWriter / gist:a26aa123519a969ac58f7c13a11ff555
Created May 14, 2025 20:01 — forked from stuarthalloway/gist:2645453
Datomic queries against Clojure collections
;; Datomic example code
(use '[datomic.api :only (db q) :as d])
;; ?answer binds a scalar
(q '[:find ?answer :in ?answer]
42)
;; of course you can bind more than one of anything
(q '[:find ?last ?first :in ?last ?first]
"Doe" "John")
@SkyWriter
SkyWriter / Configure-Ethernet-RNDIS-PiZero-connection.ps1
Created May 13, 2025 14:11 — forked from vitouXY/Configure-Ethernet-RNDIS-PiZero-connection.ps1
Raspberry Pi Zero W - USB Gadget (libcomposite) - TinyCoreLinux (piCore)
# copyright Threadsec Inc
# This script auto-configure and ssh auto-connect to RPi ZERO Ethernet gadget VID:0x1d6b PID:0x0137
# This script require admin right to access to adapter conf.
# https://threadsec.wordpress.com/raspberry-pi-zero-usb-composite-gadget/
#
# Edit $user=""
# Windows 10 : As Admin, run:
# powershell -ep bypass -file Configure-Ethernet-RNDIS-PiZero-connection.ps1
#
Clear-Host
@SkyWriter
SkyWriter / RaspberryPi4-qemu.md
Created August 7, 2024 10:34 — forked from cGandom/RaspberryPi4-qemu.md
Emulating Raspberry Pi 4 with Qemu

Emulating Raspberry Pi 4 with Qemu

Just a quick update before we dive in: what we're actually doing here is running Raspberry Pi OS (64-bit) on a QEMU virtual ARM setup. This isn't full-blown hardware emulation of the Raspberry Pi 4, but more about creating a virtual environment for the OS. It doesn't mimic all the specific hardware features of the Pi 4, but it's pretty useful and great for general testing. I turned to this solution mainly to extract a modified sysroot from the Raspberry Pi OS, something not readily available in other resources. For those looking into detailed emulation of the actual Raspberry Pi 4's hardware in QEMU, check out this link for the latest updates: https://gitlab.com/qemu-project/qemu/-/issues/1208.

Hope it helps! :D

Shortcomings: No GUI yet, only console.

Steps

-----BEGIN PGP PUBLIC KEY BLOCK-----
mQINBFWcwY8BEACjPRkozANb8p9t1n3aFBVSbas2A3WXiYTWrEdOIGuI2nah98j2
cR7m67/Va9leZx9ZNBGdnG4orZySihRg9fEJh3YJn0ofGKScuaYSaAl1tieouLCK
W8jgIRCTNMF+JOwoXAcRkc0+pOo+Q/6RKdJT/wwHI6xIvz0K+upks7MRq8gecwvU
XvF0egfNcQuwthAU/aiVFliAKSjYFvpfa6+KjaSbRKxJNmPi0kjPTSXHHrvm0vVq
9eG9Gi9lalqK7YF5/jGEOOCvzVtpQ4gFQOKZzCIXgZzVaStdfUGGsJZWjyqBlVJl
lLW7iWK9L7WQcFrngF9iEdP7AQXoM6uZNGsDOJS9jcBptDl/oOEJ1bV3QQpY3Dwx
vII4yzgZdKOqB2T7BVBSU+rhrg4pGjZJmfQSHEgFtvJYMrZl/Wh+RtI825Ja/uxs
uQ4Ai/OEt8DqntiXfcbfw5vPnI7Z3Pz7jsh0gtuekxMZiPeC115Hs6nFZiOXzSPH
@SkyWriter
SkyWriter / default.nix
Created February 10, 2024 21:19 — forked from danbst/default.nix
Proof-of-Concept running PostgreSQL tests inside Nix package build
with import <nixpkgs> { };
runCommand "some-test" {
buildInputs = [ postgresql ];
preCheck = ''
set -e
export PGDATA=$TMP/db
export PGHOST=$TMP/socketdir
mkdir $PGDATA $PGHOST
pg_ctl initdb
echo "unix_socket_directories = '$PGHOST'" >> $PGDATA/postgresql.conf
@SkyWriter
SkyWriter / README.md
Created December 17, 2023 14:28 — forked from baetheus/README.md
SmartOS Single IP with NAT using VLAN

WARNING

These intructions might work, but they need a bit of attention. I've been reading through ipf and smf documentation and have found a few ways to improve this process. When I have time I'll add that information here, until then, be sure to look into the ipf settings if you're having issues with routing. Good luck!

Foreword

This is a modified version of sjorge's instructions for Single IP with NAT. Those instructions can be found here: https://docu.blackdot.be/snipets/solaris/smartos-nat

The primary difference is that this version does not rely on etherstubs for internal switching, but instead uses a vlan configuration. The benefits of this method over using etherstubs are:

  1. Project Fifo (project-fifo.net) can create vms and zones with vlans, but does not currently have etherstub support.
  2. Vlan switching is supposedly more efficient than creating an etherstub to handle switching. I have not tested this statement.
@SkyWriter
SkyWriter / pad_packed_demo.py
Created January 14, 2023 19:30 — forked from HarshTrivedi/pad_packed_demo.py
Minimal tutorial on packing (pack_padded_sequence) and unpacking (pad_packed_sequence) sequences in pytorch.
import torch
from torch import LongTensor
from torch.nn import Embedding, LSTM
from torch.autograd import Variable
from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence
## We want to run LSTM on a batch of 3 character sequences ['long_str', 'tiny', 'medium']
#
# Step 1: Construct Vocabulary
# Step 2: Load indexed data (list of instances, where each instance is list of character indices)
@SkyWriter
SkyWriter / README.md
Created February 22, 2021 15:10
Generate BrandMeister repeater map for Google Earth