Skip to content

Instantly share code, notes, and snippets.

@moshen
moshen / .gitignore
Last active April 17, 2024 14:02
WASMagic Typescript test
dist
node_modules
@moshen
moshen / .gitignore
Last active February 16, 2024 17:08
Magika Benchmark
python
file-examples
@moshen
moshen / make_giant_doc.js
Created June 2, 2023 20:09
Short script with description for making gigantic pdfs for testing
/**
* Make some big docs to make big pdfs
*
* node make_giant_doc.js > giant.html
* wkhtmltopdf giant.html giant.pdf
*/
const NUM_PAGES = 15000;
const LOREM = `
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam placerat nibh eget
@moshen
moshen / copy-screenshots.ps1
Created January 15, 2023 17:43
Powershell script to copy Steam screenshots folders from one drive to another, for backing up screenshots or migrating to a new drive
param(
[string]$source_drive_letter,
[string]$destination_drive_letter
)
if ([string]::IsNullOrEmpty($source_drive_letter))
{
Write-Output "No source_drive_letter argument provided"
exit
}
@moshen
moshen / monitorswitch-cmm.ahk
Last active April 14, 2022 13:18
Multi Monitor switch
; Used to change the monitor source
; Requires ControlMyMonitor from https://www.nirsoft.net/utils/control_my_monitor.html
setMonitorInputSource(monitor, inputSelectCode, source)
{
cmd := "ControlMyMonitor.exe /SetValue " . monitor . " " . inputSelectCode . " " . source
Run %cmd%
}
; Map monitor switch to same keys as synergy keyboard switch
$^![::
@moshen
moshen / index.js
Created October 6, 2017 21:35
A simple benchmark of a simple date format
var Benchmark = require('benchmark');
var moment = require('moment');
var faker = require('faker');
var suite = new Benchmark.Suite;
var format = 'YYYY-MM-DD';
var dateArr = [];
var pad = "00";
for (let i = 0; i < 100000; i++) {
dateArr[i] = moment(faker.date.past()).format();
@moshen
moshen / package.json
Created July 31, 2017 17:52
LudumDare web build download and extract
{
"name": "ld-pull",
"version": "1.0.0",
"description": "Pull LudumDare web builds and unpack them",
"main": "pull.js",
"dependencies": {
"request": "^2.72.0"
},
"devDependencies": {},
"scripts": {
@moshen
moshen / functionCallMicrobenchmark.js
Last active October 7, 2015 15:29
binding this vs creating an anonymous function
var Benchmark = require('benchmark'),
suite = new Benchmark.Suite;
var obj = {
name: 'myobj',
meth: function() {
return this.name;
}
};
@moshen
moshen / init.lua
Created September 3, 2015 01:19
My hammerspoon configuration
-- Auto-reload config
function reloadConfig(files)
doReload = false
for _,file in pairs(files) do
if file:sub(-4) == ".lua" then
doReload = true
end
end
if doReload then
hs.reload()
@moshen
moshen / Dockerfile
Last active September 4, 2016 18:37
Openresty on Heroku Docker
FROM heroku/cedar:14
RUN useradd -d /app -m app
USER app
ENV HOME=/app PORT=3000 \
resty_version=1.7.10.2 rocks_version=2.1.2 \
STDOUT_PIPE="/app/openresty/nginx/logs/access" \
STDERR_PIPE="/app/openresty/nginx/logs/error"