Skip to content

Instantly share code, notes, and snippets.

@renfredxh
renfredxh / .ctags
Last active August 7, 2020 14:16
Typescript ctags config
--langdef=typescript
--langmap=typescript:.ts.tsx
--regex-typescript=/^[ \t]*(export)?[ \t]*class[ \t]+([a-zA-Z0-9_]+)/\2/c,classes/
--regex-typescript=/^[ \t]*(declare)?[ \t]*namespace[ \t]+([a-zA-Z0-9_]+)/\2/c,modules/
--regex-typescript=/^[ \t]*(export)?[ \t]*module[ \t]+([a-zA-Z0-9_]+)/\2/n,modules/
--regex-typescript=/^[ \t]*(export)?[ \t]*function[ \t]+([a-zA-Z0-9_]+)/\2/f,functions/
--regex-typescript=/^[ \t]*export[ \t]+var[ \t]+([a-zA-Z0-9_]+)/\1/v,variables/
--regex-typescript=/^[ \t]*var[ \t]+([a-zA-Z0-9_]+)[ \t]*=[ \t]*function[ \t]*\(\)/\1/v,varlambdas/
--regex-typescript=/^[ \t]*(export)?[ \t]*(public|protected|private)[ \t]+(static)?[ \t]*([a-zA-Z0-9_]+)/\4/m,members/
--regex-typescript=/^[ \t]*(export)?[ \t]*interface[ \t]+([a-zA-Z0-9_]+)/\2/i,interfaces/
@renfredxh
renfredxh / clean-images.rb
Last active August 29, 2015 14:09
Clean untagged Docker images and zombie containers
#!/usr/bin/env ruby
# Description: Sometimes after building, starting and killing a number of
# docker containers over time, you end up with images that cannot be removed
# removed because zombie containers are referencing them. This removes all
# images of a given name or untagged images and the container that
# reference them.
#
# Disclaimer: This is recommended for development environments only.
# Frivolous usage may result in unintended data loss.
#
@renfredxh
renfredxh / keybase.md
Last active August 29, 2015 14:07
Keybase Verification

Keybase proof

I hereby claim:

  • I am renfredxh on github.
  • I am renfredxh (https://keybase.io/renfredxh) on keybase.
  • I have a public key whose fingerprint is C33E B29E 79D7 B679 C3AC 9EB4 4896 719E C9F7 6CF3

To claim this, I am signing this object:

@renfredxh
renfredxh / watch.sh
Created September 13, 2014 04:36
Watch directory and evaluate command
#!/bin/bash
path="../grails-app"
command="grails compile"
chsum1=""
echo "Watching ${path} for changes"
while [[ true ]]
do
chsum2=`find ${path} -type f -exec md5sum {} \;`
@renfredxh
renfredxh / Dockerfile
Created August 11, 2014 04:46
What's Open Docker file
############################################################
# Dockerfile to build What's Open Django App
############################################################
# Instructions:
#
# Note: You need to edit the empty string on the line that
# says "ENV SECRET_KEY" to be a secure random value.
#
# Any initialized data that needs to be imported should be
"""
Two things are wrong with Django's default `SECRET_KEY` system:
1. It is not random but pseudo-random
2. It saves and displays the SECRET_KEY in `settings.py`
This snippet
1. uses `SystemRandom()` instead to generate a random key
2. saves a local `secret.txt`
@renfredxh
renfredxh / Dockerfile
Last active August 29, 2015 14:04
SRCTweb Dockerfile
############################################################
# Dockerfile to build SRCTweb flask application
# Based on Ubuntu
############################################################
# Instructions:
#
# Build: sudo docker build -t srctweb .
# Run: sudo docker run -p 8000:80 -i -t -d srctweb
#
@renfredxh
renfredxh / 404.html
Created July 31, 2014 00:53
Matrix 404
<html>
<head>
<title>404</title>
<style>
body {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
background: #000;
@renfredxh
renfredxh / vforward.rb
Created July 9, 2014 15:25
Forward multiple ports from localhost to Vagrant
#!/usr/bin/env ruby
# Description: Forwards one or more ports from your localhost to a Vagrant VM
# via ssh. Useful for viewing multiple dev applications in Vagrant at once.
#
# Installation:
# $ mv vforward.rb /usr/bin/vforward
# $ chmod +x /usr/bin/vforward
#
# Usage: vforward [ports ...]
@renfredxh
renfredxh / remind.py
Last active February 8, 2022 16:21
Set reminders via OSX terminal
#!/usr/local/bin/python3
# Make a new reminder via terminal script
# args: remind <title> <date> <time>
# example: remind clean 12/10/2012 10:00:00PM
import subprocess
import sys
from datetime import datetime, timedelta
# A apple script that creates a new reminder given a name date and time
OSASCRIPT = ('<<END\n'