Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
#
# Copyright (c) 2014, Intel Corporation
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
@zyguan
zyguan / liqubase-completion.bash
Last active May 23, 2018 14:08
bash-completion for liquibase
#!/bin/bash
_liquibase()
{
local cur=${COMP_WORDS[COMP_CWORD]}
local prv=${COMP_WORDS[COMP_CWORD-1]}
local opts cmds
opts="$(liquibase --help 2>&1 | grep -e '^ --[a-z][a-zA-Z]*' -o)"
cmds="$(liquibase --help 2>&1 | grep -e '^ [a-zA-Z]\+' -o)"
// ==UserScript==
// @name iVoc
// @namespace http://tampermonkey.net/
// @version 0.1
// @description save your search history on bing/dict!
// @author zyguan
// @match https://cn.bing.com/dict*
// @grant GM_getValue
// @grant GM_setValue
// @grant GM_deleteValue
// ==UserScript==
// @name bilibot
// @namespace http://live.bilibili.com/
// @version 0.1
// @description get your award automatically
// @author zyguan
// @include http://live.bilibili.com/*
// @exclude http://live.bilibili.com/
// @grant none
// @require https://github.com/antimatter15/ocrad.js/raw/master/ocrad.js
@zyguan
zyguan / 0_reuse_code.js
Last active February 17, 2017 16:02
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
from inspect import isgenerator
def fact(n):
if n <= 1:
return n
else:
f = yield fact(n-1)
return f * n
def fib(n):
@zyguan
zyguan / calc.y
Created April 14, 2016 08:27
An example of go yacc
// Copyright 2011 Bobby Powers. All rights reserved.
// Use of this source code is governed by the MIT
// license that can be found in the LICENSE file.
// based off of Appendix A from http://dinosaur.compilertools.net/yacc/
// original work: https://github.com/golang-samples/yacc
%{
@zyguan
zyguan / CV.css
Created March 1, 2016 13:32 — forked from Sth0nian/CV.css
body {
background-color: gray;
}
article {
width:720px;
margin:auto;
margin-top: -10px;
font-family:helvetica,
verdana, sans-serif;
padding-bottom:3em;
@zyguan
zyguan / mvn-get
Last active March 1, 2016 00:50
从 Android 创建的 Gist
#! /bin/sh
repos="http://maven.oschina.net/content/groups/public/"
mvn dependency:get -DremoteRepositories="$repos" -Dartifact="$1"
-- Firefox saves your browsing history data in places.sqlite. So it's
-- possible to know about your behavior by a sql select statement.
-- Here is an example.
--
-- (https://support.mozilla.org/en-US/kb/recovering-important-data-from-an-old-profile)
--
SELECT host, count(*) FROM moz_historyvisits h LEFT JOIN
(SELECT id, substr(substr(url, instr(url,'://')+3),
0,instr(substr(url, instr(url,'://')+3),'/')) AS host