Skip to content

Instantly share code, notes, and snippets.

@huyz
huyz / buildresticexcludes.sh
Last active Sep 22, 2020 — forked from Vartkat/buildresticexcludes.sh
Bash script to build a restic exclude list that mimics Apple TimeMachine exclude list
View buildresticexcludes.sh
#!/bin/bash
# This script intend to mimic TimeMachine exclude list.
# As the exclude list can evolve between backups it has to be rebuilt before every backup
# Apple uses 5 types of excludes:
# - 4 `/System/Library/CoreServices/backupd.bundle/Contents/Resources/StdExclusions.plist`
# - and files from applications where metadata says to not backup, these can be found usinr
# `sudo mdfind "com_apple_backup_excludeItem = 'com.apple.backupd'"`
PLISTBUDDY=/usr/libexec/PlistBuddy
@huyz
huyz / cardinalConstraints.js
Last active Jun 29, 2019
Uber interview question: cardinal constraints
View cardinalConstraints.js
// Problem description: https://interviewcache.com/blog/direction-validation/
function areCardinalConstraintsValid(rules) {
console.log(rules);
console.log(_areCardinalConstraintsValid(rules));
console.log();
}
function _areCardinalConstraintsValid(rules) {
// We choose N-S and E-W instead of S-N and W-E because of the English idioms "north to south" and "east to west",
@huyz
huyz / keybase.md
Created Sep 25, 2017
Keybase proof
View keybase.md

Keybase proof

I hereby claim:

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

To claim this, I am signing this object:

View merge_asana_into_omnifocus.rb
#!/usr/bin/env ruby -E utf-8
# merge_asana_into_omnifocus.rb
# Hilton Lipschitz
# http://www.hiltmon.com
# Use and modify freely, attribution appreciated
# Script to import Asana projects and their tasks into
# OmniFocus and keep them up to date from Asana.
@huyz
huyz / main_decompiled.js
Created Sep 6, 2011
Google+ Translate extension main.js decompiled
View main_decompiled.js
/* Copyright 2011 Google */
(function() {
var injectionScript = fillInTemplate("(function(){({{$code}})();})();", {
code: window.injection.toString()
}),
injectorScript = fillInTemplate("(function(){({{$code}})();})();", {
code: window.injector.toString()
});
delete window.injector;
delete window.injection;
@huyz
huyz / wp-syntax.css
Created Jul 4, 2011
wp-syntax.css for Twenty-Ten WP theme
View wp-syntax.css
#content .wp_syntax {
color: #100;
background-color: #f9f9f9;
border: 1px solid silver;
margin: 0 0 1.5em 0;
overflow: auto;
}
/* IE FIX */
#content .wp_syntax {
@huyz
huyz / less.vim
Created Jul 3, 2011
less.vim debugging
View less.vim
" Vim script to work like "less"
" huyz 2011-07-03 Modified for better quit handling. See 'm' script.
"
" Maintainer: Bram Moolenaar <Bram@vim.org>
" Last Change: 2006 Dec 05
" Avoid loading this file twice, allow the user to define his own script.
if exists("loaded_less")
finish
endif
You can’t perform that action at this time.