Skip to content

Instantly share code, notes, and snippets.

Chris Yuen kizzx2

Block or report user

Report or block kizzx2

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
kizzx2 / with-env.ps1
Last active Oct 12, 2019
Run command with environment variables in PowerShell
View with-env.ps1
$ori = @{}
Try {
$i = 0
# Loading .env files
if(Test-Path $args[0]) {
foreach($line in (Get-Content $args[0])) {
if($line -Match '^\s*$' -Or $line -Match '^#') {
kizzx2 / hammerspoon-move-resize.lua
Last active Sep 17, 2019
Hammerspoon script to move/resize window under cursor
View hammerspoon-move-resize.lua
-- Inspired by Linux alt-drag or Better Touch Tools move/resize functionality
function get_window_under_mouse()
-- Invoke `hs.application` because `hs.window.orderedWindows()` doesn't do it
-- and breaks itself
local _ = hs.application
local my_pos =
local my_screen = hs.mouse.getCurrentScreen()
kizzx2 /
Last active Apr 29, 2019
Run multiple commands, and open them all in synchronized tmux panes
# The MIT License (MIT)
# Copyright (c) 2013 Chris Yuen
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
kizzx2 / fun.cpp
Last active Mar 2, 2019
Illustrative C++ Lua binding example/tutorial
View fun.cpp
// fun.cpp
// This is for Lua 5.2, for Lua 5.1, see
#include <lua.hpp>
#include <iostream>
#include <sstream>
class Foo
View diginex.css
:root {
--side-bar-bg-color: #fafafa;
--control-text-color: #777;
@include-when-export url(,700italic,700,400&subset=latin,latin-ext);
@font-face {
font-family: 'Open Sans';
font-style: normal;
View ginit.vim
call rpcnotify(1, 'Gui', 'Font', 'Fira Code 22')
let s:fontsize = 22
function! AdjustFontSize(amount)
let s:fontsize = s:fontsize+a:amount
call rpcnotify(1, 'Gui', 'Font', 'Fira Code ' . s:fontsize)
noremap <c-+> :call AdjustFontSize(1)<CR>
noremap <c--> :call AdjustFontSize(-1)<CR>
kizzx2 / post.rb
Last active Dec 31, 2018
A clean and elegant approach to partial object validation with Rails + Wicked wizards (using session to store the partial object)
View post.rb
class Post < ActiveRecord::Base
attr_accessible :body, :price, :title
validates_presence_of :title
validates_length_of :title, minimum: 10
validates_presence_of :body
validates_numericality_of :price, greater_than: 0
kizzx2 / fun.cpp
Created Jan 11, 2012
Illustrative C++ Lua binding example/tutorial
View fun.cpp
// fun.cpp
extern "C"
#include <lua.h>
#include <lauxlib.h>
#include <lualib.h>
#include <iostream>
kizzx2 /
Last active Jul 17, 2018
Simple script to start Shadowsocks + GFWList and configures OS X system preferences to use it
# Simple script to start Shadowsocks + GFWList and configures
# OS X system preferences to use it
if [[ $(id -u) -ne 0 ]]
sudo sh $0
kizzx2 / docker-compose.yml
Created Jun 23, 2018
Restart a docker container periodically with docker-compose
View docker-compose.yml
version: '3'
image: nginx:alpine
ports: ["80:80"]
restart: unless-stopped
image: docker
volumes: ["/var/run/docker.sock:/var/run/docker.sock"]
You can’t perform that action at this time.