Skip to content

Instantly share code, notes, and snippets.

Crystal on WASM

Running

  • crystal wasm.cr
  • php -S localhost:3000
  • open your browser
  • open dev tool js console
  • crystal.add(1, 2)
@mikhail-angelov
mikhail-angelov / gen_ssl.sh
Created November 25, 2018 14:39
docker tls certificates
#!/bin/bash
export OPENSSL_CONF=openssl.cnf
echo 'Creating CA (ca-key.pem, ca.pem)'
echo 01 > ca.srl
openssl genrsa -des3 -passout pass:password -out ca-key.pem 2048
openssl req -new -passin pass:password \
-subj '/CN=Non-Prod Test CA/C=US' \
@Pathoschild
Pathoschild / google-sheets-color-preview.js
Last active July 4, 2023 12:07
A Google Sheets script which adds color preview to cells. When you edit a cell containing a valid CSS hexadecimal color code (like #000 or #000000), the background color is changed to that color and the font color is changed to the inverse color for readability.
/*
This script is meant to be used with a Google Sheets spreadsheet. When you edit a cell containing a
valid CSS hexadecimal color code (like #000 or #000000), the background color will change to that
color and the font color will be changed to the inverse color for readability.
To use this script in a Google Sheets spreadsheet:
1. go to Tools » Script Editor;
2. replace everyting in the text editor with this code;
3. click File » Save;
@frdmn
frdmn / osx-10-10-virtualbox.md
Last active February 22, 2022 08:39
Install OS X 10.10 Yosemite in VirtualBox
@thoop
thoop / nginx.conf
Last active December 8, 2023 21:55
Official prerender.io nginx.conf for nginx
# Change YOUR_TOKEN to your prerender token
# Change example.com (server_name) to your website url
# Change /path/to/your/root to the correct value
server {
listen 80;
server_name example.com;
root /path/to/your/root;
index index.html;
@kroger
kroger / midi2mp3
Last active December 18, 2023 17:03
Convert MIDI files to MP3 using fluidsynth. See
#!/usr/bin/env bash
SOUNDFONT=/Users/kroger/Dropbox/Sfonts/BOPLMEVF16.sf2
TMPDIR=/tmp
if [[ ! -f $SOUNDFONT ]]
then
echo "Couldn't find the soundfont: $SOUNDFONT"
exit 1
@jayd3e
jayd3e / gist:6196323
Last active December 20, 2015 21:18
On local machine:
mkdir ~/Boxes
cd ~/Boxes
git clone git@github.com:clusterflunk/clusterstack.git
easy_install pip
pip install ansible
cp ~/.ssh/id_rsa.pub ~/Boxes/clusterstack/roles/common/files/.ssh/
cp ~/.ssh/id_rsa ~/Boxes/clusterstack/roles/common/files/.ssh/
vagrant up
vagrant ssh
@reidransom
reidransom / gist:6042016
Created July 19, 2013 20:13
Auto-starting VirtualBox VMs on OS X

Auto-starting VirtualBox VMs on OS X

After finding a lot of other posts on the topic that didn't work out for me this one did the trick so I'm reposting for my own sense of self preservation.

Link to original article.

Copy the Virtualbox autostart plist template file to your system's LaunchDaemons folder.

sudo cp \

/Applications/VirtualBox.app/Contents/MacOS/org.virtualbox.vboxautostart.plist \

@acook
acook / keypress.rb
Created December 2, 2012 18:42
Read keypresses from user in terminal, including arrow keys using pure Ruby. This has since been folded into a much more robust gem called Remedy. https://rubygems.org/gems/remedy & https://github.com/acook/remedy
require 'io/console'
# Reads keypresses from the user including 2 and 3 escape character sequences.
def read_char
STDIN.echo = false
STDIN.raw!
input = STDIN.getc.chr
if input == "\e" then
input << STDIN.read_nonblock(3) rescue nil