Skip to content

Instantly share code, notes, and snippets.

View ad-si's full-sized avatar
🎯
Working on airsequel.com

Adrian Sieber ad-si

🎯
Working on airsequel.com
View GitHub Profile
@montasaurus
montasaurus / llmc.sh
Last active April 20, 2024 21:32
AI Shell Command Generator
llmc() {
local system_prompt='Output a command that I can run in a ZSH terminal on macOS to accomplish the following task. Try to make the command self-documenting, using the long version of flags where possible. Output the command first enclosed in a "```zsh" codeblock followed by a concise explanation of how it accomplishes it.'
local temp_file=$(mktemp)
local capturing=true
local command_buffer=""
local first_line=true
local cleaned_up=false # Flag to indicate whether cleanup has been run
cleanup() {
# Only run cleanup if it hasn't been done yet
@janwirth
janwirth / README.md
Last active November 14, 2022 12:06
awesome-custom-elements
@dino-
dino- / string-conversions.hs
Last active May 3, 2024 08:57
A handy illustration of converting between String, Text and ByteString in Haskell
#! /usr/bin/env stack
-- stack --resolver lts-18.8 script
{-# LANGUAGE OverloadedStrings #-}
{-
This is a handy illustration of converting between five of the commonly-used
string types in Haskell (String, ByteString, lazy ByteString, Text and lazy
Text).
@simonmichael
simonmichael / wellsfargo.hs
Last active January 19, 2019 17:42
A WIP Wells Fargo bank scraper in haskell that I couldn't get working reliably (2016). If you do, please let me know!
#!/usr/bin/env stack
{- stack exec
--verbosity info
--package webdriver
-- ghc
-}
--package data-default
-- stack exec ghci wellsfargo
-- stack exec ghc wellsfargohs
--
@azdle
azdle / books_download_cmds.js
Last active March 18, 2022 19:34
Humble Bundle Easy Get All
//
// This scripts builds wget commands for you to paste into a terminal. It will download
// all formats of all books currently showing on the page.
//
cmds = "";
for (a of document.getElementsByTagName("a")) {
if (a.href.startsWith("https://dl.humble.com")) cmds += "wget --content-disposition '" + a.href + "'<br>";
};
@chrisdone
chrisdone / Aeson.hs
Created November 20, 2017 17:38
Arbitrary Value (Aeson)
instance Arbitrary Aeson.Value where
arbitrary = sized sizedArbitraryValue
sizedArbitraryValue :: Int -> Gen Aeson.Value
sizedArbitraryValue n
| n <= 0 = oneof [pure Aeson.Null, bool, number, string]
| otherwise = resize n' $ oneof [pure Aeson.Null, bool, number, string, array, object']
where
n' = n `div` 2
bool = Aeson.Bool <$> arbitrary
@egmontkob
egmontkob / Hyperlinks_in_Terminal_Emulators.md
Last active May 3, 2024 11:35
Hyperlinks in Terminal Emulators
@zlbruce
zlbruce / svg2icns
Created October 1, 2016 01:17
covert svg to icns (with imagemagick)
#!/bin/bash
echo "*** SVG 2 ICNS ***"
if [ $# -ne 1 ]; then
echo "Usage: svg2icns filename.svg"
exit 100
fi
filename="$1"
name=${filename%.*}
ext=${filename##*.}
echo "processing: $name"
@rauschma
rauschma / about-proposal.md
Last active October 6, 2023 18:30
Enum proposal

Advantages compared to using symbols as enum values:

  • Enum values are much more customizable. For example, one can have custom prototype and/or instance methods.
  • Enum values get two custom properties:
    • name provides direct access to the name of an enum value.
    • ordinal holds a number, the position of the enum value. Useful for some applications.
  • One can use instanceof to test whether a value is an element of an enum.
  • One occasionally requested feature for enums is that enum values be numbers (e.g. for flags) or strings (e.g. to compare with values in HTTP headers). That can be achieved by making those values properties of enum values. For an example, see enum Mode, below.

Static properties of enums:

@ChiChou
ChiChou / unhex.sql
Last active October 11, 2023 05:44
SQLite3 convert hex string to int (requires sqlite >= 3.8.3)
WITH RECURSIVE
unhex(str, val, weight) AS (
SELECT 'deadbeef', 0, 1
UNION ALL
SELECT
substr(str, 1, length(str) - 1),
val + (instr('0123456789ABCDEF', substr(str, length(str), 1)) - 1) * weight,
weight * 16
FROM unhex WHERE length(str) > 0
)