Skip to content

Instantly share code, notes, and snippets.

package org.dummy.jmhbench
object FeatureFlags {
val enabled: String = System.getenv("FEATURE-FLAG-ENABLED") ?: "false"
val enabledT: Boolean = enabled.toBoolean()
fun viaFunction(): String {
return System.getenv("FEATURE-FLAG-ENABLED") ?: "false"
}
# better handle tonumber errors
def parseCpu($cpu): (
if ($cpu == null) then
$cpu
else
(if ($cpu|endswith("m")) then
($cpu|rtrimstr("m")|tonumber)/1000
else
($cpu|tonumber)/1
end)
@thewisenerd
thewisenerd / ReqW7MAjqb48.js
Created December 9, 2022 10:45
azure cost portal url decode
// string sanitization?
function t(n) {
for (var t, i = [], r = 0; r < n.length; r++)
t = n.charCodeAt(r),
t < 128
? i.push(t)
: t < 2048
? i.push(192 | t >> 6, 128 | t & 63)
: t < 55296 || t >= 57344
? i.push(224 | t >> 12, 128 | t >> 6 & 63, 128 | t & 63)
import org.asynchttpclient.DefaultAsyncHttpClient
import org.asynchttpclient.DefaultAsyncHttpClientConfig
import org.asynchttpclient.RequestBuilder
import org.asynchttpclient.Response
import org.junit.Ignore
import org.junit.Test
import java.io.IOException
@Ignore
class TestClientTimeout {
@thewisenerd
thewisenerd / dont-run-this-lmao.sh
Created November 16, 2022 21:34
installing facebook prophet on macOS arm64
brew install python@3.11
python3.11 -m pip install cmdstanpy
python3.11 -m pip install prophet # this should work ? if it dont, good luck lmao
# at this point, you might get an error
# RuntimeError: Error during optimization! Command '/opt/homebrew/lib/python3.11/site-packages/prophet/stan_model/prophet_model.bin
# dyld[71677]: Library not loaded: '@rpath/libtbb.dylib'
cd /opt/homebrew/lib/python3.11/site-packages/prophet/stan_model
install_name_tool -add_rpath @executable_path/cmdstan-2.26.1/stan/lib/stan_math/lib/tbb prophet_model.bin
# 'Prophet.fit' should no longer throw a fit haha
#!/usr/bin/env python3
import email
import email.header
import email.message
import email.utils
import hashlib
import json
import os
import quopri
@thewisenerd
thewisenerd / 01-sqlite-compile.sh
Created September 14, 2022 23:28
macOS python compilation with enable-loadable-sqlite-extensions
# kangeth homebrew somewhat: https://github.com/Homebrew/homebrew-core/blob/b5cb06cdea07ccb18fdf4a186148cfd3db23e874/Formula/sqlite.rb
env CPPFLAGS="-DSQLITE_ENABLE_COLUMN_METADATA=1 -DSQLITE_MAX_VARIABLE_NUMBER=250000" \
./configure \
--prefix=$HOME/works/unix/binaries/sqlite \
--enable-dynamic-extensions \
--enable-readline \
--disable-editline \
--enable-session
make install
#!/usr/bin/env bash
set -euo pipefail
if [[ $# -eq 2 ]]; then
upstream="$1"
topic="$2"
elif [[ $# -eq 1 ]]; then
@thewisenerd
thewisenerd / ascii_table.txt
Created January 25, 2022 12:29
ASCII Table
000 0x00 NUL // Null
001 0x01 SOH // Start Of Heading
002 0x02 STX // Start Of Text
003 0x03 ETX // End Of Text
004 0x04 EOT // End Of Transmit
005 0x05 ENQ // Enquiry
006 0x06 ACK // Acknowledge
007 0x07 BEL // Bell
008 0x08 BS // Backspace
009 0x09 TAB // Horizontal Tab
@thewisenerd
thewisenerd / sheet-cal.js
Created September 6, 2021 09:14
google-app script for extracting calendar data
function listUpcomingEventsInternal(today, calendarId, colorMap, targets) {
var startOfWeek = new Date(today);
startOfWeek.setHours(0, 0, 0, 0);
if (startOfWeek.getDay() !== 1) {
startOfWeek.setHours(-24 * (startOfWeek.getDay() - 1));
}
var endOfWeek = new Date(startOfWeek);
endOfWeek.setHours(+24 * 7);
var optionalArgs = {
timeMin: startOfWeek.toISOString(),