Skip to content

Instantly share code, notes, and snippets.

<!DOCTYPE html>
<html>
<head>
{{>head}}
{{#user}}
<title>Back {{name}} checkout | satsbacker</title>
{{/user}}
</head>
<body>
{{>header}}
@ocramz
ocramz / get_highlighted_text.html
Last active November 3, 2022 21:05
Get highlighted text (Firefox, Chrome but not on IE)
<!DOCTYPE html>
<html>
<body>
Select some text below and then click the button:<br/>
<textarea id="myText" rows="5" cols="60" onselect="alert(getTextSelection())">
Lorem ipsum dolor sit amet,
consectetur adipiscing elit.
</textarea>
@ocramz
ocramz / URIDecoding.hs
Created April 23, 2023 12:26
decoding URI-encoded strings in Haskell
import Data.Bits ((.|.),(.&.),shiftL)
import Data.Char (chr, isHexDigit, digitToInt)
import Data.Text (Text, pack, unpack)
{-
sources :
uri-encode (https://hackage.haskell.org/package/uri-encode-1.5.0.7/docs/src/Network.URI.Encode.html#decodeText)
network-uri (https://hackage.haskell.org/package/network-uri-2.6.4.2/docs/src/Network.URI.html#unEscapeString)
@ocramz
ocramz / aws-ec2-cuda118-ubuntu2204.sh
Created July 7, 2023 12:20
Setup CUDA 11.8 drivers, miniconda and pytorch on Ubuntu 22.04 on AWS EC2
#!/bin/bash
apt update
apt -y install build-essential # install GCC
apt -y install --reinstall software-properties-common # enable add-apt-repository
apt-get -y install lshw
apt-get clean
export DISTRO_UBUNTU=ubuntu2204/x86_64