Skip to content

Instantly share code, notes, and snippets.

View curtisalexander's full-sized avatar

Curtis Alexander curtisalexander

  • Fayetteville, AR
  • 10:09 (UTC -05:00)
View GitHub Profile
@karl-zylinski
karl-zylinski / tracking_alloc_example.odin
Created March 3, 2024 20:26
Example of how to setup tracking allocator
// from https://odin-lang.org/docs/overview/#when-statements, see end of that section
package main
import "core:fmt"
import "core:mem"
main :: proc() {
when ODIN_DEBUG {
track: mem.Tracking_Allocator
@jart
jart / rename-pictures.sh
Created December 12, 2023 15:24
Shell script for renaming all images in a folder
#!/bin/sh
# rename-pictures.sh
# Author: Justine Tunney <[email protected]>
# License: Apache 2.0
#
# This shell script can be used to ensure all the images in a folder
# have good descriptive filenames that are written in English. It's
# based on the Mistral 7b and LLaVA v1.5 models.
#
# For example, the following command:
@oskarnp
oskarnp / Odin.sublime-build
Last active October 29, 2024 02:07
Sublime build system for Odin
{
"selector":"source.odin",
"file_regex": "^(.+)\\(([0-9]+):([0-9]+)\\) (.+)$",
"shell_cmd":"odin check \"$file_path\" -no-entry-point",
"variants":[
//
// current file
//
// syntax check

Excel Tables and VBA

It's 2020, and there's now many ways to work with data of arbitrary length in Excel:

  • Power Query's M language
  • JavaScript
  • dynamic arrays.

But if you use or support older Excel versions, VBA can still be useful.

@HQJaTu
HQJaTu / trigger-Azure-CDN-certificate-update.ps1
Created June 18, 2019 18:57
Azure CDN certificate update trigger
#Requires -Version 6.0
<#
The MIT License (MIT)
Copyright (c) 2019 Jari Turkia ([email protected])
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
@CMCDragonkai
CMCDragonkai / stay-awake.ps1
Last active May 1, 2025 17:38
Keep Windows Awake Temporarily (Prevent Sleep, Display Off or Away Mode) #cli #powershell #windows
#!/usr/bin/env powershell
# This script can keep the computer awake while executing another executable, or
# if no executable was passed in, then it stays awake until this script stops.
# There are 3 different ways of staying awake:
# Away Mode - Enable away mode (https://blogs.msdn.microsoft.com/david_fleischman/2005/10/21/what-does-away-mode-do-anyway/)
# Display Mode - Keep the display on and don't go to sleep or hibernation
# System Mode - Don't go to sleep or hibernation
# The default mode is the System Mode.
# Away mode is only available when away mode is enabled in the advanced power options.
@cdhunt
cdhunt / map_fold.ps1
Created October 27, 2016 13:55
Map and Fold implementations in Powershell
function map([scriptblock]$map, [Collections.IEnumerable]$x, $y) { $x.ForEach({& $map $_ $y}) }
# Two parameters
map { param($x, $y) $x + $y } @(1,2,3) 10
# Anonymous function as a value
$squareIt = { param($x) $x + $x }
map $squareIt @(1,2,3)
# One parameter
library(rgdal)
library(sp)
library(albersusa) # devtools::install_github("hrbrmstr/albersusa")
library(spdplyr) # devtools::install_github("mdsumner/spdplyr")
library(ggplot2) # devtools::install_github("hadley/ggplot2")
library(ggthemes)
library(rgeos)
library(purrr)
library(broom)
library(magick)
# rm -r /tmp/hmda
install.packages("MonetDBLite")
library(DBI)
dbdir <- "/tmp/hmda"
con <- dbConnect(MonetDBLite::MonetDBLite(), dbdir)
# download at http://homepages.cwi.nl/~hannes/hmda.rds
dd <- readRDS("/tmp/hmda.rds")
@dannguyen
dannguyen / EXAMPLE_WATSON_API_README.md
Last active November 23, 2020 13:32
Transcribing ProPublica podcast with Python and Watson Speech to Text API

Using IBM Watson Speech to Text API to translate a ProPublica podcast

An example of using the Watson Speech to Text API to translate a podcast from ProPublica: How a Reporter Pierced the Hype Behind Theranos

This is just a simpler demo of the same technique I demonstrate to make automated video supercuts in this repo: https://github.com/dannguyen/watson-word-watcher

The transcription takes just a few minutes (less if you parallelize the requests to IBM) and is free...but it isn't perfect by any means. It doesn't fare super well on proper nouns:

  • Charles Ornstein's last name is transcribed as Orenstein
  • John Carreyrou's last name becomes John Kerry Roo