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 / nyan.pl
Created December 1, 2011 16:29
Terminal Nyancat 256 color
#!/usr/bin/env perl
use warnings;
use strict;
# Animation frames...
# Color ASCII escape sequences, gzipped and base64 encoded, because
# I thought 300 lines of animation frames was a little much.
my @frames = ( q(
H4sIAHywIU8AA+1d23XkOA797xT8oxBst+11z4QyMVQO+7ExbIAbydrdVXqCeJOEKNQZnzMURIq4
BEAU6jb19M/b59/vfz/fnv78z8uvj9u0+zz98yUFrrI6PG473nX8wA/68cSYI+fze/hlNkvz9fWV
@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 / prompt.bash
Last active February 20, 2022 01:40
A Fancy Bash Prompt
#!/bin/bash
#
# Fancy prompt
#
# Source this file in your .bashrc
#
# Configuration options:
#
# Set _prompt_config to an array of strings. Each string is in the
@moshen
moshen / devonly_tag.rb
Created April 17, 2012 04:53
Jekyll Dev Only Tag
#
# Jekyll Dev Only Tag
#
# Author : Colin Kennedy
# Usage :
#
# The markup/script/css included within the `devonly` tags
# is included in the rendered page when either:
#
# * `server` mode is used
@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 / 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();