Skip to content

Instantly share code, notes, and snippets.

@saesh
saesh / texlive.profile
Last active June 7, 2020 13:32
texlive installation profile to be compatible with https://github.com/mrzool/letter-boilerplate
# texlive.profile written on Sun Jun 7 13:22:14 2020 UTC
# It will NOT be updated and reflects only the
# installation profile at installation time.
selected_scheme scheme-custom
TEXDIR /usr/local/texlive/2020
TEXMFCONFIG ~/.texlive2020/texmf-config
TEXMFHOME ~/.texmf
TEXMFLOCAL /usr/local/texlive/texmf-local
TEXMFSYSCONFIG /usr/local/texlive/2020/texmf-config
TEXMFSYSVAR /usr/local/texlive/2020/texmf-var
@saesh
saesh / pro-micro-qmk-linux.md
Last active February 19, 2022 16:22
Flash Pro Micro with QMK on Linux

Install QMK as described in the QMK docs.

Make sure avrdude is installed.

Execute make keebio/bdn9:default:avrdude and you will be prompted to reset the controller, do so by shorting RST and GND.

Troubleshooting:

When:

@saesh
saesh / ok60-qmk-linux.md
Last active February 23, 2019 09:01
Flash OK60 board with QMK firmware on Linux

Install QMK as described in the QMK docs.

Start OK60 board in DFU mode by holding the reset switch while plugging in the USB cable. To verify it is DFU mode use dmesg on Linux:

[  131.319371] usb 1-1.5.3: USB disconnect, device number 7
[  142.036587] usb 1-1.5.3: new full-speed USB device number 8 using ehci-pci
[  142.147630] usb 1-1.5.3: New USB device found, idVendor=03eb, idProduct=2ff4
[  142.147633] usb 1-1.5.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[  142.147636] usb 1-1.5.3: Product: ATm32U4DFU

[ 142.147638] usb 1-1.5.3: Manufacturer: ATMEL

@saesh
saesh / brew.txt
Created March 14, 2018 14:36
homebrew commands
> brew list | while read cask; do echo -n $fg[blue] $cask $fg[white]; brew deps $cask | awk '{printf(" %s ", $0)}'; echo ""; done
gdbm
gettext
git
htop
libyaml
luajit
nvm
openssl
perl
-- Find out whether a list is a palindrome. A palindrome can be read forward or backward; e.g. (x a m a x).
isPalindrome :: Eq a => [a] -> Bool
isPalindrome list
| length list == 0 = True
| length list == 1 = True
| otherwise = (head list == last list) && isPalindrome (init $ tail list)
main :: IO ()
main = print $ isPalindrome "lagerregal"
-- Reverse a list.
listReverse :: [a] -> [a]
listReverse [x] = [x]
listReverse l = last l : listReverse (init l)
main :: IO ()
main = print $ listReverse ["first", "second", "third"]
-- Find the number of elements of a list.
listLength :: Num b => [a] -> b
listLength l = sum (map (\_ -> 1) l)
main :: IO ()
main = print $ listLength ["a", "b", "c", "d"]
-- Find the K'th element of a list. The first element in the list is number 1.
elementAt :: [a] -> Int -> a
elementAt list k = (last (take k list))
main :: IO ()
main = print $ elementAt "wikipedia" 5
-- Find the last but one element of a list.
numbers = [1, 2, 3]
lastButOne x = last (init x)
main :: IO ()
main = print $ lastButOne numbers