Skip to content

Instantly share code, notes, and snippets.

View CarlOlson's full-sized avatar
🗾

Carl Olson CarlOlson

🗾
View GitHub Profile
let input = "{\"id\": 1, \"cell\":{\"id\":\"12345678-etc\"}}";
let obj = JSON.parse(input)
console.log(obj.cell.id); // 12345678-etc
let match = obj.cell.id.match(/^\d*/);
let id = match[0];
console.log(id) // 12345678
console.log(typeof id) // string
# remove all Modern apps from the system account
Get-AppXProvisionedPackage -online | Remove-AppxProvisionedPackage -online
# remove Metro apps for all user accounts
Get-AppxPackage -AllUsers | Remove-AppxPackage
# regedt32.exe
# Goto HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\CloudContent
# Create a new 32-bit DWORD value named DisableWindowsConsumerFeatures and set its value data to 1
@CarlOlson
CarlOlson / x11.md
Created January 12, 2020 20:00
X11 Sharing Troubleshooting

Can't open display?

Ensure DISPLAY is exported and equal to host's DISPLAY.

$ export DISPLAY=:0

No protocol specified?

@CarlOlson
CarlOlson / example.js
Created December 5, 2019 13:47
Anki RTK Kanji<->Keyword on Hover Script
let mapping = {
福: "blessing"
};
let element = document.querySelector("pre");
let chars = [...element.innerText];
element.innerHTML = "";
chars.map((char) => {
if ((/[\u4E00-\u9FAF\uFF66-\uFF9D]/).test(char)) {

Keybase proof

I hereby claim:

  • I am carlolson on github.
  • I am carlolson (https://keybase.io/carlolson) on keybase.
  • I have a public key ASBG51QFOqz-icgxUoDWKD3jM6j1PI-xgHstGOMrGtotoAo

To claim this, I am signing this object:

mkdir -p notrust/.ssh
touch notrust/.ssh/authorized_users
useradd -d notrust notrust
chown -R notrust:notrust notrust
chown root:root notrust
chmod 700 notrust/.ssh
chmod 644 notrust/.ssh/authorized_users
echo 'AllowUsers ... notrust' > /etc/ssh/sshd_config
@CarlOlson
CarlOlson / main.py
Created November 18, 2017 21:10
Global Day of Coderetreat
from itertools import product
def get_neighbors(coordinate):
row = ord(coordinate[0])
col = int(coordinate[1:])
return [
make_coordinate(row + x - 1, col + y - 1)
for x, y in product(range(3), range(3))
if (x,y) != (1,1)

Forward

This will be the steps to setup my (very opinionated) shell environment. Many things may go wrong (environmental variables, paths, etc), but this could be a great learning opertunity.

Use the man command for help! Man pages are viewed in less, try man less to learn how to navigate them better!

Setup

Install Nix Package Manager

(defmacro se--when-windows (&rest body)
(declare (indent 1))
`(when (or (eq system-type 'ms-dos)
(eq system-type 'windows-nt)
(eq system-type 'cygwin))
,@body))
(se--when-windows
(defun se--remove-drive-letter (path)
@CarlOlson
CarlOlson / osx-build.org
Created March 28, 2017 15:11
Cedille build instructions for OSX (and maybe linux)

OSX Setup

First install the nix package manager: https://nixos.org/nix/

Then install the dependencies:

nix-env -f "<nixpkgs>" -iA haskellPackages.ghc
nix-env -f "<nixpkgs>" -iA haskellPackages.cabal-install
nix-env -f "<nixpkgs>" -iA haskellPackages.Agda
cabal update
cabal install ieee