Skip to content

Instantly share code, notes, and snippets.

View voronoipotato's full-sized avatar

Alan Ball voronoipotato

  • NC
View GitHub Profile
@voronoipotato
voronoipotato / readme.md
Created December 9, 2022 04:03 — forked from josefnpat/readme.md
Going from Lua 5.2 to PICO-8's Lua

This information applies to the PICO-8 0.1.6 release.

This document is here to help folks with a proficiency in Lua understand the limitations and discrepencies between Lua and PICO-8's Lua.

You can always view the manual or yellowafterlife's extended 0.1.1 manual.

General

  • anything written in uppercase the PICO-8 editor or .p8 is made lowercase by the editor. → editing the .p8 file directly can work
  • print(function() end) outputs the string function instead of the string function: 0x0000000.
@voronoipotato
voronoipotato / srtp.fsx
Created October 15, 2022 17:22 — forked from michaeloyer/srtp.fsx
F# SRTP Example
// SRTP: Statically Resolved Type Parameters
// https://docs.microsoft.com/en-us/dotnet/fsharp/language-reference/generics/statically-resolved-type-parameters
// SRTP Allows for pulling members out of types that where the member is named and typed the same
// In this example SRTP will be used to pull out the 'First: string' and 'Last: string' members
// from different types
// One example of SRTP in the F# Base Class Library is the (+) operator.
// You'll see that it has this type signature:
@voronoipotato
voronoipotato / gist:01a0dd1357cfedcf17e928a8ef2b1afd
Created September 19, 2019 02:10 — forked from jorool/gist:57714bcdc06953531749
Powershell script to download images from multiple urls
$images = 'https://foo.jpg', 'https://bar.jpg'
$targetDir = 'C:\foo\bar'
function DownloadFile([Object[]] $sourceFiles,[string]$targetDirectory) {
$wc = New-Object System.Net.WebClient
foreach ($sourceFile in $sourceFiles){
$sourceFileName = $sourceFile.SubString($sourceFile.LastIndexOf('/')+1)
$targetFileName = $targetDirectory + $sourceFileName
$wc.DownloadFile($sourceFile, $targetFileName)
@voronoipotato
voronoipotato / generate_series.sql
Created July 26, 2018 21:54 — forked from sebastianwebber/generate_series.sql
SQL Server generate_series
-- http://blog.jooq.org/2013/11/19/how-to-create-a-range-from-1-to-10-in-sql/
IF EXISTS (SELECT *
FROM dbo.sysobjects
WHERE id = object_id (N'[dbo].[generate_series]')
AND OBJECTPROPERTY(id, N'IsTableFunction') = 1)
DROP FUNCTION [dbo].[generate_series]
GO
CREATE FUNCTION [dbo].[generate_series] ( @p_start INT, @p_end INT)
@voronoipotato
voronoipotato / base64-web-safe.js
Created January 23, 2018 19:38 — forked from geraintluff/base64-web-safe.js
Convert base64 to and from web-safe variant
// Convert from normal to web-safe, strip trailing "="s
function webSafe64(base64) {
return base64.replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/, '');
}
// Convert from web-safe to normal, add trailing "="s
function normal64(base64) {
return base64.replace(/\-/g, '+').replace(/_/g, '/') + '=='.substring(0, (3*base64.length)%4);
}
@voronoipotato
voronoipotato / fizzbuzz_in_DBN.fsx
Created September 26, 2017 20:56 — forked from paralax/fizzbuzz_in_DBN.fsx
i ported that "fizzbuzz in tensorflow" to F# and Accord.Net's DeepBeliefNetwork
// i ported that "fizzbuzz in tensorflow" to F# and Accord.Net's DeepBeliefNetwork
// http://joelgrus.com/2016/05/23/fizz-buzz-in-tensorflow/
#r "Debug/Accord.dll"
#r "Debug/Accord.Math.dll"
#r "Debug/Accord.Neuro.dll"
#I "Debug"
open Accord.Neuro
open Accord.Neuro.Networks
@voronoipotato
voronoipotato / EventStoreConnectionExtensions.cs
Created April 24, 2017 17:46 — forked from jen20/EventStoreConnectionExtensions.cs
Quick and dirty way to hook up RX to an Event Store subscription. Emphasis on "quick" and "dirty".
static class EventStoreConnectionExtensions
{
public static Task<EventStoreRxSubscription> SubscribeToAll(this EventStoreConnection connection, bool resolveLinkTos)
{
return Task<EventStoreRxSubscription>.Factory.StartNew(() => {
var subject = new Subject<ResolvedEvent>();
var subscriptionTask = connection.SubscribeToAll(resolveLinkTos, subject.OnNext, () => subject.OnError(new SubscriptionDroppedException()));
subscriptionTask.Wait();
@voronoipotato
voronoipotato / introrx.md
Created August 18, 2016 14:31 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
@voronoipotato
voronoipotato / latency.txt
Created February 16, 2016 21:22 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers
--------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@voronoipotato
voronoipotato / tmux-cheatsheet.markdown
Created January 14, 2016 16:19 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname