Skip to content

Instantly share code, notes, and snippets.

View leopku's full-sized avatar

Song Liu leopku

View GitHub Profile
@leopku
leopku / ffmpeg.md
Created January 10, 2023 00:28 — forked from steven2358/ffmpeg.md
FFmpeg cheat sheet
@leopku
leopku / cheatsheet-elasticsearch.md
Created August 30, 2021 09:42 — forked from ruanbekker/cheatsheet-elasticsearch.md
Elasticsearch Cheatsheet : Example API usage of using Elasticsearch with curl
@leopku
leopku / is-private-mode.js
Created December 20, 2017 12:08 — forked from jherax/is-private-mode.js
Detect if a browser is in Private Browsing mode
/**
* Detect if the browser is running in Private Browsing mode
*
* @export
* @returns {Promise}
*/
export default function isPrivateMode() {
return new Promise((resolve) => {
const on = () => resolve(true); // is in private mode
const off = () => resolve(false); // not private mode
@leopku
leopku / aria2.conf
Created July 16, 2017 12:34 — forked from zfz/aria2.conf
aria2c scripts
#用户名
#rpc-user=user
#密码
#rpc-passwd=passwd
#上面的认证方式不建议使用,建议使用下面的token方式
#设置加密的密钥
#rpc-secret=token
#允许rpc
enable-rpc=true
#允许所有来源, web界面跨域权限需要
@leopku
leopku / .gitlab-ci-golang-glide.yml
Created June 7, 2017 10:47 — forked from tsdtsdtsd/.gitlab-ci-golang-glide.yml
Config for building a golang 1.8 application with glide vendoring on gitlab-ci
image: golang:1.8-alpine # The alpine builds are much smaller but lack tools we need, we'll add them later
stages:
- build
- test
before_script:
- apk --update --upgrade add git curl-dev openssh curl ca-certificates # This is how we add system dependencies.
# You may need less or more packages for your app.
- curl -sS https://glide.sh/get | sh
- mkdir -p /go/src/gitlab.com/
@leopku
leopku / scdaemon_reload.py
Created November 2, 2016 05:21 — forked from bigeagle/scdaemon_reload.py
Along with udevedu, reload gpg scdaemon on yubikey insert
#!/usr/bin/env python2
# -*- coding:utf-8 -*-
from __future__ import print_function, division, unicode_literals
from udevedu.utils import invoke
def init():
print("Monitor Yubikey NEO")
@leopku
leopku / ansible.coffiee
Created October 15, 2016 05:22 — forked from shirou/ansible.coffiee
ansible + hubot + slack integration
settings = {
'test': {
'path': '/home/shirou/ansible/test/',
'inventory': 'inventory'
}
}
module.exports = (robot) ->
@leopku
leopku / fakeldap.rb
Created September 22, 2016 09:39 — forked from krobertson/fakeldap.rb
fakeldap - fake data generator for LDAP
#
# Ugly little script I used when I needed to generate an LDAP DB with 100k sample users
#
require 'rubygems'
require 'faker'
require 'active_ldap'
ActiveLdap::Base.establish_connection(
:host => '10.0.0.8',
@leopku
leopku / auto_install_sublime_packages.markdown
Created August 18, 2016 08:58 — forked from vishaltelangre/auto_install_sublime_packages.markdown
[Automate Packages Installation in Sublime Text 2] -- Automatically install Sublime Text 2 packages (some necessary ones, w/o fucking crap ones which makes sublime alike hell!)
  • To install packages, every time pressing ' ctrl+shift+pPackage Control: Install Package is very cumbersome task... right?

  • After fresh installation of ST2, open it and ctrl+` and hit enter after pasting below line [(1)][1]:

  import urllib2,os; pf='Package Control.sublime-package'; ipp=sublime.installed_packages_path(); os.makedirs(ipp) if not os.path.exists(ipp) else None; urllib2.install_opener(urllib2.build_opener(urllib2.ProxyHandler())); open(os.path.join(ipp,pf),'wb').write(urllib2.urlopen('http://sublime.wbond.net/'+pf.replace(' ','%20')).read()); print('Please restart Sublime Text to finish installation')
  • Restart ST2.

  • Open terminal, and navigate to Sublime's dir under your home folder by below command and create file w/ name Package Control.sublime-settings there in:

@leopku
leopku / simple_args_parsing.sh
Created March 2, 2016 07:06 — forked from jehiah/simple_args_parsing.sh
a simple way to parse shell script arguments
#!/bin/sh
#
# a simple way to parse shell script arguments
#
# please edit and use to your hearts content
#
ENVIRONMENT="dev"