Skip to content

Instantly share code, notes, and snippets.

@zamber
zamber / Preferences.sublime-settings
Created October 4, 2015 09:23
My Sublime Text 3 settings.
{
"binary_file_patterns":
[
".DS_Store",
"node_modules/",
"*.png",
"*.psd",
"*.jpg",
"*.gif",
"*.min.js",
@zamber
zamber / gen-menu.py
Last active May 21, 2020 15:57
A simple and dirty menu generator for MkDocs. Human sorting, titlecase and automatic numeration.
#!/usr/bin/python
# https://gist.github.com/zamber/af5086cb9c097be5c002
import os
import re
from titlecase import titlecase # pip install titlecase
# Config
root = 'src'
os.chdir(root)
@zamber
zamber / windowprops.sh
Created June 10, 2015 15:09
Key binding for getting window properties for writing i3-wm `for_window` rules
#!/bin/sh
# Get active window properties for writing `for_window` rules
# In ~/.i3/config:
# bindsym $mod+g ~/.i3/windowprops.sh
NAME=$(xprop -id `xdotool getactivewindow` | grep 'WM_NAME(STRING)')
CLASS=$(xprop -id `xdotool getactivewindow` | grep 'WM_CLASS(STRING)')
notify-send "$NAME
$CLASS"
@zamber
zamber / gist:4a2ae25549ac3786fbe2
Last active July 13, 2018 08:59
Merging a Subdirectory from Another Repository.md

Merging a Subdirectory from Another Repository

In this brief guide I'll show you how to copy one directory from one repository to another with the hisotry for it intact.

If you are unsure what you are doing then work on clean clones of your source and target repositories.

Let's get the terminology straight now. We will be going from this state:

  • repo-from
  • tasty-directory
@zamber
zamber / Limelight.css
Last active August 29, 2015 14:19
LimeChat - Limelight for ZNC
/*
LimeChat Limelight Theme
Modified for smaller server and status messages. Makes living with ZNC much easier.
*/
html {
font-family: "Dejavu Sans Mono", "Monaco", monospace;
font-size: 9pt;
background-color: #202020;
color: #FFFFFF;
@zamber
zamber / README.md
Last active August 29, 2015 14:11
Restore Chrome User Switching UI

Google Chrome just ruined the user switching UI. To restore it:

  1. Go to chrome://flags
  2. Disable #enable-new-profile-management
  3. Enable #enable-fast-user-switching
  4. Disable #enable-new-avatar-menu
@zamber
zamber / .zshrc
Last active August 29, 2015 14:07
ZSH expanding aliases in emacs mode
################################################################################
# Change java version
################################################################################
function setjdk() {
if [ $# -ne 0 ]; then
removeFromPath '/System/Library/Frameworks/JavaVM.framework/Home/bin'
if [ -n "${JAVA_HOME+x}" ]; then
removeFromPath $JAVA_HOME
fi
#
# MTSH (MoreTerra Simple Helper) v0.1.0
# PowerShell 3.0
#
# Generate world images from Terraria world with MoreTerra
# Configure and fork it as you see fit.
#
# To schedule it as a task follow this http://j.mp/schedule-powershell
#
# To host it use http://cestana.com/mongoose.shtml
@zamber
zamber / varnishlnkfile.te
Last active August 17, 2017 17:00
SELinux: Varnish + reading symlinks in /etc/varnish
module varnishlnkfile 1.0.0;
# The changes linked below did not trigger a version bump so on some systems reading usr_t in .vcl's is restricted
# http://j.mp/selinux-varnish-symlinks
# @gist https://gist.github.com/Zamber/7d82850abf3a17fdd401
require {
type usr_t;
type varnishd_t;
@zamber
zamber / analytics.js
Created April 9, 2014 15:28
Track downloads and external links with ga.js
/*
Track downloads and external links with ga.js
Append to your spagetti object container and then just run
self.Analytics.init() at the end of the global init() function.
*/
Analytics: {
init: function () {
var self = this;