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
View diginex.css
:root {
--side-bar-bg-color: #fafafa;
--control-text-color: #777;
}
@include-when-export url(https://fonts.loli.net/css?family=Open+Sans:400italic,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)
endfunction
noremap <c-+> :call AdjustFontSize(1)<CR>
noremap <c--> :call AdjustFontSize(-1)<CR>
@kizzx2
kizzx2 / docker-compose.yml
Created Jun 23, 2018
Restart a docker container periodically with docker-compose
View docker-compose.yml
version: '3'
services:
app:
image: nginx:alpine
ports: ["80:80"]
restart: unless-stopped
restarter:
image: docker
volumes: ["/var/run/docker.sock:/var/run/docker.sock"]
@kizzx2
kizzx2 / commitlint.vim
Created Mar 7, 2018
ALE Linter for commitlint
View commitlint.vim
function! ale_linters#gitcommit#commitlint#Handle(buffer, lines) abort
" Matches patterns line the following:
let l:pattern = '^\(✖\|⚠\)\s\+\(.*\) \(\[.*\]\)$'
let l:output = []
let l:line = getline(1)
if l:line[0] != '#'
for l:match in ale#util#GetMatches(a:lines, l:pattern)
let l:item = {
\ 'lnum': 1,
@kizzx2
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 '^#') {
continue
}
@kizzx2
kizzx2 / orientationchanged.js
Created Jun 16, 2017
Get the correct window.innerHeight for 'orientationchanged' event
View orientationchanged.js
// Wait until innerheight changes, for max 120 frames
function orientationChanged() {
const timeout = 120;
return new window.Promise(function(resolve) {
const go = (i, height0) => {
window.innerHeight != height0 || i >= timeout ?
resolve() :
window.requestAnimationFrame(() => go(i + 1, height0));
};
go(0, window.innerHeight);
@kizzx2
kizzx2 / 03-rabbitmq-input.conf
Last active May 27, 2017
A docker-compose set up that has nginx -> ELK through RabbitMQ
View 03-rabbitmq-input.conf
input {
rabbitmq {
host => "rabbitmq"
exchange => "logstash"
exchange_type => "direct"
key => "logstash"
durable => true
}
}
View socat-sendfile.sh
# Server sending file
server$ socat -u FILE:test.dat TCP-LISTEN:9876,reuseaddr
client$ socat -u TCP:127.0.0.1:9876 OPEN:out.dat,creat
# Server receiving file
server$ socat -u TCP-LISTEN:9876,reuseaddr OPEN:out.txt,creat && cat out.txt
client$ socat -u FILE:test.txt TCP:127.0.0.1:9876
@kizzx2
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 = hs.geometry.new(hs.mouse.getAbsolutePosition())
local my_screen = hs.mouse.getCurrentScreen()
@kizzx2
kizzx2 / start-ss.sh
Last active Jul 17, 2018
Simple script to start Shadowsocks + GFWList and configures OS X system preferences to use it
View start-ss.sh
#!/bin/sh
# Simple script to start Shadowsocks + GFWList and configures
# OS X system preferences to use it
if [[ $(id -u) -ne 0 ]]
then
sudo sh $0
exit
fi
You can’t perform that action at this time.