Skip to content

Instantly share code, notes, and snippets.

@thingsiplay
thingsiplay / save ()
Last active May 31, 2023 11:06
save - Capture and reuse output of command (Bash function)
# save - Capture and reuse output of command
# A Bash function
#
# usage: save [file]
#
# On start of the Bash session a new temporary file is created that lives as
# long as this terminal session lives. This is the default file. It's path can
# be looked up in the environmental variable $SAVE. Anytime `save` runs, it
# will lookup this variable. The first argument to `save` is a file path that
# will be used as $SAVE file. A manual set file won't be deleted automatically.

WSL 2 with CUDA

Set up Windows Subsystem for Linux (version 2) with CUDA support + TensorFlow.

Before you start

  • You must be on Windows 10 21H2 or above.

    Note: On my system 21H2 could not be updated to. I ended up with a bricked install as Windows tried to install Windows 11 on my unsupported CPU. I recommend just installing Windows 10 21H2 directly from an ISO.

  • You don't have to be on OS build 20140 or above as some sources state. My build: 19044.1469
  • Install the latest "game ready driver" for your card.
@motorailgun
motorailgun / idea.md
Last active June 18, 2024 06:22
Installing Windows and Linux into the same partition

Installing Windows and Linux into the same partition

But WHY?

There was a reddit post about installing Arch on NTFS3 partition. Since Windows and Linux doesn't have directories with same names under the /(C:\), I thought it's possible, and turned out it was actually possible.
If you are not familiar to Linux, for example you've searched on Google "how to dualboot Linux and Windos" or brbrbr... you mustn't try this. This is not practical.

Pre-requirements

  • UEFI system
  • Any Linux live-boot CD/DVD/USB... with Linux kernel newer than 5.15
  • Windows installer USB
@gordonbrander
gordonbrander / README.md
Last active April 25, 2023 20:38
microview - data-driven views that render once per frame, at most

Microview

What if... Virtual DOM... but by hand?
aha ha, just kidding...
unless.. ?

Microview is a tiny library for writing efficient data-driven DOM rendering logic by hand. DOM writes are driven by a pure data model. Using Microview, you can freely "bash the dom". Writes will be batched — they'll only happen once per animationframe, and only if the data model changes.

@jcreinhold
jcreinhold / unet.py
Created July 9, 2020 21:28
U-Net in PyTorch
"""
U-Net architecture in PyTorch (https://arxiv.org/abs/1505.04597)
Author: Jacob Reinhold ([email protected])
"""
import torch
from torch import nn
from torch.nn import functional as F
@miraculixx
miraculixx / markup.py
Last active April 12, 2023 17:13
an extensible multi-markup reader in less than 100 lines of python code
# (c) miraculixx, licensed as by the terms of WTFPL, http://www.wtfpl.net/txt/copying/
# License: DO WHATEVER YOU WANT TO with this code.
#
# THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#
from io import StringIO
from contextlib import contextmanager

Guix on WSL2

(updated versions of this document, plus more, live here)

This will show you how to get Guix running on WSL2.
We're going to go as "minimal" as possible, without starting off one of the readily available WSL2 distros.
Parts of this guide should help with understanding how to set up any custom distro on WSL, not just Guix.

Disclaimer: I'm a Guix nOOb! (hence going through the trouble of installing it on WSL2)

@roman01la
roman01la / clojurescript-repl-workflow.md
Last active October 22, 2022 12:07
ClojureScript REPL Workflow

ClojureScript REPL Workflow

Short write up on using REPL when developing UIs in ClojureScript.

Hot-reload on save or Eval in REPL?

Everyone's standard approach to hot-reloading is to use a tool (Figwheel or shadow-cljs) that reloads changed namespaces automatically. This works really well: you change the code, the tool picks up changed files, compiles namespaces and dependants, notifies REPL client which then pulls in compiled changes, and re-runs a function that re-renders UI.

The other approach is to use ClojureScript's REPL directly and rely only on eval from the editor. This more or less matches Clojure style workflow. This approach might be useful when you don't want tools overhead or hot-reloading becomes slow for you or you just used to this style of interactions. Also changing code doesn't always mean that you want to reload all the changes. On the other hand it is very easy to change a couple of top-level forms and forget to eval one of them.

@devstopfix
devstopfix / ants.clje
Last active May 14, 2020 15:53
Rich Hickey's ants simulator ported to Clojure on the BEAM
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Ant sim ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Copyright (c) 2008 Rich Hickey. All rights reserved.
; The use and distribution terms for this software are covered by the
; Common Public License 1.0 (http://opensource.org/licenses/cpl.php)
; which can be found in the file CPL.TXT at the root of this distribution.
; By using this software in any fashion, you are agreeing to be bound by
; the terms of this license.
; You must not remove this notice, or any other, from this software.
;
; Original Clojure JVM code :- https://gist.github.com/michiakig/1093917
@doriantaylor
doriantaylor / threadapalooza.pl
Created December 18, 2019 02:24
this is what was used to get @vgr's threadapalooza
#!/usr/bin/perl
use strict;
use warnings FATAL => 'all';
use Storable ();
use Math::BigInt ();
use JSON ();
use Path::Class ();
use Net::Twitter ();