Skip to content

Instantly share code, notes, and snippets.

@awesomebjt
awesomebjt / setup_clojure.sh
Created November 10, 2022 12:06
Steps to set up your Clojure environment on Fedora 37+
#!/bin/bash
sudo yum install -y java-latest-openjdk clojure emacs rlwrap
rm -rf ~/.emacs ~/.emacs.d
curl https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein > ~/.local/bin/lein
chmod +x ~/.local/bin/lein
wget https://github.com/flyingmachine/emacs-for-clojure/archive/book1.zip
unzip book1.zip
mv emacs-for-clojure-book1 ~/.emacs.d
@awesomebjt
awesomebjt / custom_bash_prompt.sh
Created July 25, 2021 20:52
praxeo custom Arch Linux bash prompt coloring in bold, with teal username and white path
# Put this into /etc/bash.bashrc
if [[ ${EUID} == 0 ]] ; then
PS1='\[\033[01;31m\]\u\[\033[0;37m\]@\h \[\033[01;37m\]\W \$ \[\033[00m\]'
else
PS1='\[\033[01;36m\]\u\[\033[0;37m\]@\h \[\033[01;37m\]\W \$ \[\033[00m\]'
fi
@awesomebjt
awesomebjt / VSCodeHaskell-FixPthread.md
Created March 10, 2021 16:44
Fixing "pthread or dependencies not loaded" error in Visual Studio Code with the Haskell extension

After installing the Haskell extension for VSCode in Windows 10, I kept getting an error message that included the text:

user specified .o/.so/.DLL could not be loaded (addDLL: pthread or dependencies not loaded. (Win32 error 5)) Whilst trying to load: (dynamic) pthread

This StackOverflow question gave me the correct answer.

I found C:\Windows\System32\pthread.dll and changed its permissions to allow my user read and execute access. By default it was only available to administrators for some reason, and completely blocked for everyone else.

After changing this, the Haskell extension started working perfectly.

@awesomebjt
awesomebjt / DynamoSession.py
Created August 20, 2016 13:44
Store your Flask sessions in DynamoDB - Python 3.5
from uuid import uuid4
from datetime import datetime, timedelta
from flask.sessions import SessionInterface, SessionMixin
from werkzeug.datastructures import CallbackDict
import boto3
class DynamoSession(CallbackDict, SessionMixin):
def __init__(self, initial=None, sid=None):
CallbackDict.__init__(self, initial)
@awesomebjt
awesomebjt / csv_to_json.py
Created August 20, 2015 18:47
CSV to JSON in Python
import csv
import json
import sys
#Expects argument 1 to be a .csv filename. Matching file ending in .json is written.
if sys.argv[1] is not None and len(sys.argv[1])>0:
infile = open(sys.argv[1],'r')
outfile = open(sys.argv[1].replace(".csv",".json"),'w')
reader = csv.reader(infile)
colnames = []