Skip to content

Instantly share code, notes, and snippets.

View stephan281094's full-sized avatar

Stephan de Vries stephan281094

View GitHub Profile
@stephan281094
stephan281094 / keybase.md
Last active December 22, 2021 09:25
keybase.md

Keybase proof

I hereby claim:

  • I am stephan281094 on github.
  • I am stephan281094 (https://keybase.io/stephan281094) on keybase.
  • I have a public key ASDFWunGCi1tSEZwRJbRrfdTi0w2lH9Wp2xYWwCD1ebh_go

To claim this, I am signing this object:

@stephan281094
stephan281094 / timer.lisp
Last active April 9, 2020 23:17
My first Lisp program
(defun pluralize (amount word)
(if (= amount 1) word (format NIL "~ds" word))
)
(defun main ()
(format t "~%Set a timer (in seconds): ")
(let
((idx (read)))
(loop
@stephan281094
stephan281094 / machine.js
Created November 26, 2019 08:25
Generated by XState Viz: https://xstate.js.org/viz
const gameMachine = Machine({
id: "quiz",
type: "parallel",
states: {
user: {
initial: "idle",
states: {
idle: {
on: {
ANSWER: "participating"
@stephan281094
stephan281094 / mysql-vagrant.md
Last active August 31, 2017 07:02
Access MySQL on host with Vagrant
  • Add the following to your Vagrantfile:
# Forward port for MySQL.
config.vm.network :forwarded_port, guest: 3306, host: 3306`
  • Run: vagrant provision.
  • SSH into vagrant with vagrant ssh.
  • Add the following to /etc/mysql/mysqld.conf.d/mysqld.cnf:
bind-address = 0.0.0.0
@stephan281094
stephan281094 / retargetsym.sh
Last active February 8, 2017 09:17
Make it easy to bulk replace symlink targets with a common pattern.
#!/bin/bash
for sym in $(find $1 -type l); do
target=$(readlink $sym)
new=${target/$2/$3}
echo "Retargeting '$sym' to '$new'.."
rm $sym && ln -s $new $sym
done
@stephan281094
stephan281094 / slorem.sublime-snippet
Last active November 11, 2015 10:25
Motherfucking placeholder text snippet for SublimeText motherfucker!
<snippet>
<description>Motherfucking placeholder text motherfucker!</description>
<content><![CDATA[
You think water moves fast? You should see ice. It moves like it has a mind. Like it knows it killed the world once and got a taste for murder. After the avalanche, it took us a week to climb out. Now, I don't know exactly when we turned on each other, but I know that seven of us survived the slide... and only five made it out. Now we took an oath, that I'm breaking now. We said we'd say it was the snow that killed the other two, but it wasn't. Nature is lethal but it doesn't hold a candle to man.
]]></content>
<tabTrigger>slorem</tabTrigger>
<scope>-source</scope>
</snippet>
@stephan281094
stephan281094 / vagrant-share-multiple.md
Last active October 25, 2016 22:13
Using Vagrant Share with multiple sites

Using Vagrant Share with multiple sites

Vagrant Share is a great feature that's quite handy to demo your application to clients. It basically allows you to share whatever you run locally on your VM, accessible by anybody who is connected to the internet. However, Vagrant Share doesn't support multiple domains pointing to different applications on your virtual machine. Unless you use different ports. This document will teach you how to set your virtual machine up to allow sharing multiple projects with Vagrant Share.

Note: This document is primary based on a virtual machine running Apache.

The setup

  1. Create a free account at HashiCorp's Atlas.
  2. Login using vagrant login.
@stephan281094
stephan281094 / installing-memcache.md
Last active August 29, 2015 14:28
Installing memcache

Installing memcache (Ubuntu)

You must do the following steps to get memcache (without the d) installed:

Installing PEAR

  1. Run curl -O http://pear.php.net/go-pear.phar
  2. Run sudo php -d detect_unicode=0 go-pear.phar
  3. Type 1 and press return
  4. Enter: /usr/local/pear
  5. Type 4 and press return
@stephan281094
stephan281094 / background-url-regex.js
Last active August 29, 2015 14:24
CSS background url regex
var regex = /url\('?"?([a-zA-Z0-9\.\-\_\/]+\.(jpg|gif|png))"?'?\)/g;
@stephan281094
stephan281094 / zipcode_regex
Last active August 29, 2015 14:15
Zipcode regex
/^([A-PR-UWYZ0-9][A-HK-Y0-9][AEHMNPRTVXY0-9]?[ABEHMNPRVWXY0-9]? {1,2}[0-9][ABD-HJLN-UW-Z]{2}|GIR 0AA|[0-9]{4,5}|[0-9]{4}[ ]?[a-zA-Z]{2})$/