Skip to content

Instantly share code, notes, and snippets.

View shapr's full-sized avatar
🏃
VENTRE À TERRE

Shae Erisson shapr

🏃
VENTRE À TERRE
View GitHub Profile
@shapr
shapr / Transcoder.hs
Created February 9, 2023 18:02
transcode all FLAC files to 16bit 44.1 kHz with sox
module Main where
import Core
import System.Directory
import System.FilePath
import System.Process
import Data.Maybe
import Data.List
main :: IO ()
module Main where
import System.Directory
import System.FilePath
import System.Process
import Data.Maybe
import Data.List
myMusicDirectory = "/home/shae/Music"
module Main where
import Data.Time.Clock
import Data.Time.Format
import Data.Time.Format.ISO8601
import System.Cmd
import System.Directory
main :: IO ()
main = do
@shapr
shapr / Main.hs
Created December 12, 2022 19:31
Inside Termux: apt install ghc, adb push Main.hs $(dest dir); ghc --make -package base Main.hs ; LD_PRELOAD=$PWD/libchallenge_bypass_ristretto_ffi.so ./Main
{-# LANGUAGE ForeignFunctionInterface #-}
module Main where
import Foreign.C.String
import Foreign.Ptr
data C_Token
foreign import ccall "lib.h token_random" tokenRandom :: IO (Ptr C_Token)
foreign import ccall "lib.h token_encode_base64" tokenEncodeBase64 :: (Ptr C_Token) -> IO CString
@shapr
shapr / sqlblock.org
Created December 5, 2022 16:41
tiny demo of sql blocks in org-mode
\d
List of relations
SchemaNameTypeOwner
publicoldertableshae
publicupdatestableshae
add_newline = true
format = "$all"
[battery]
full_symbol = "+(bold blue)"
charging_symbol = "⚡(bold green)"
discharging_symbol = "-(bold red)"
[[battery.display]] # "bold red" style and discharging_symbol when capacity is between 0% and 10%
threshold = 10
style = "bold red"
@shapr
shapr / mpc.el
Created September 19, 2022 00:15
Shae's old elisp code
;;; mpc.el --- quick hack to make remote control bindings for mpd via the mpc client
; started out as xmms-shell, became alsaplayer-shell, is now mpc
;; copyright (C) 2005 Shae Matijs Erisson
;; released under the Lesser GPL license.
;; Author: Shae Erisson <[email protected]>
;; Keywords: multimedia mpc mpd fnord mp3 eris ogg flac
;; Version: 0.3
@shapr
shapr / Beggar.rs
Created July 19, 2022 18:59
Beggar My Neighbor in Rust, designed to go as fast as possible
use fastrand;
use std::collections::VecDeque;
use std::fmt;
use std::time::Instant;
impl fmt::Display for Game {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
let p1: String = self.p1deal.iter().map(show_card).collect();
let p2: String = self.p2deal.iter().map(show_card).collect();
write!(fmt, "{} {} {}", self.steps, p1, p2)
@shapr
shapr / Main.hs
Created June 9, 2022 20:26
skeleton for advent of code 2015 day 1 part 1
module Main where
main :: IO ()
main = do
theFile <- readFile "input.txt"
print (theFunction theFile)
theFunction x = x
mylength :: Num p => [a] -> p
@shapr
shapr / Transcriptor.hs
Created May 25, 2022 23:20
Haskell script to call ffmpeg
module Main where
import Data.Time.Clock
import Data.Time.Format
import Data.Time.Format.ISO8601
import System.Cmd
import System.Directory
main :: IO ()
main = do