Skip to content

Instantly share code, notes, and snippets.

View kvz's full-sized avatar

Kevin van Zonneveld kvz

View GitHub Profile
@kvz
kvz / resolving_dns_issues.txt
Created January 18, 2012 21:48
Amazon resolving DNS issues
root@cuc:~# grep nameserver /etc/resolv.conf
nameserver 172.16.0.23
root@cuc:~# time ssh git@github.com
ssh: Could not resolve hostname github.com: Temporary failure in name resolution
real 0m40.043s
user 0m0.000s
sys 0m0.008s
@kvz
kvz / coffee-to-es6.md
Last active November 15, 2017 23:23
Going from CoffeeScript to ES6

These are the steps I took to change a modest project from CoffeeScript to ES6.

My ~2000LoC project took me around 6 hours to port, but I sunk 3 hours into a stupid mistake, and 2 into figuring out these steps, so with these steps & warnings at your disposal already, you should be able to do bigger projects in considerably less time.

Automatic tools only take you so far, there will be some manual fixing. Sometimes the generated code clearly doesn't look like a human wrote it, and sometimes there are bugs.

In this last case, when porting software trips over a particular bit of CoffeeScript, comment this bit out, and try transpiling the file again. If this is successfull, you'll see the commented CoffeeScript inside the JS, and you can port that bit yourself.

Okay let's dive right in!

### Keybase proof
I hereby claim:
* I am kvz on github.
* I am kvz (https://keybase.io/kvz) on keybase.
* I have a public key ASBOLSEUJ1qnWYocbZI5HSEDtFxMFma0A4g47p_Hp1Oz6wo
To claim this, I am signing this object:
#!/usr/bin/env bash
# Git Timetracker. Copyright Kevin van Zonneveld (kvz.io)
# License under MIT
#
# This file
#
# - can be run inside a git repository to get a list on what hours work took place (for billing)
# - takes 1 argument: since. It defaults to "2 months"
#
# Usage:
{config, pkgs, ...}:
let
unstable_pkgs = import (pkgs.fetchFromGitHub {
owner = "NixOS";
repo = "nixpkgs";
rev = "a20a20f1363246000307e6dfeaf16d49daa4e06a";
sha256 = "06n770ia7s8wj7niisf9sazgq4g4q1sw5f8ah65h56k67dpdnpfq";
}) {};
in
{config, pkgs, ...}:
{
/*
Inspired by http://lethalman.blogspot.nl/2015/02/nixos-consul-nginx-and-containers.html
*/
nixpkgs.config.packageOverrides = pkgs: rec {
consul070 = pkgs.stdenv.lib.overrideDerivation pkgs.consul (oldAttrs: {
name = "consul-0.7.0";
@kvz
kvz / gist:a566ba3be4a3faf7d6e6
Last active May 10, 2016 11:39
Proposal for (partial) template includes
{
include_template: "a", // <-- full template, used as a base
is_video: {
use: ":original",
robot: "/file/filter",
accepts: [
[
"${file.mime}",
"regex",
"video"
@kvz
kvz / gist:e9f5b113f07763e49161
Last active February 21, 2016 15:16
todays-modal-todos.md
Some todos I can think off:
- [ ] Make Modal prettier and accessible using Artur's research
- [ ] Convert `GoogleDrive` to adhere to `Dummy`'s format, so it'sare compatible with the new Modal
- [ ] Convert `DragDrop` to adhere to `Dummy`'s format, so it'sare compatible with the new Modal
- [ ] Make `ProgressBar` work with the new Modal
- [ ] Rename FakeModal to Modal, deprecating our old one
- [ ] Make the Modal look like Harry's sketchup
- [ ] ?
#!/usr/bin/env bash
#
# A Git pre-commit hook that checks for syntax errors
# for: Ruby, JavaScript, Python, Bash, and (Cake)PHP
# based on the extensions of staged files in Git.
# Can be 'installed globally' as of Git 1.7.1 using init.templatedir
#
# Copyright 2013, kvz (http://twitter.com/kvz)
#
# Some common caveats have been taken care of:
ubuntu@beth:/tmp$ time dig @4.2.2.2 +time=3 +tries=1 +short tmp.transloadit.com.s3.amazonaws.com
s3-1-w.amazonaws.com.
205.251.243.73
real 0m0.079s
user 0m0.004s
sys 0m0.000s
ubuntu@beth:/tmp$ time dig @8.8.8.8 +time=3 +tries=1 +short tmp.transloadit.com.s3.amazonaws.com
;; connection timed out; no servers could be reached