Skip to content

Instantly share code, notes, and snippets.

tka

Block or report user

Report or block tka

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
@tka
tka / PKGBUILD
Last active May 28, 2017
opencv-contrib-3.2
View PKGBUILD
# Maintainer: Andrew Crerar <andrew (at) crerar (dot) io>
# Contributor: Valentin Churavy <v.churavy@gmail.com>
# Contributor: Romain Reignier <rom.reignier@gmail.com>
# Contributor: Fabien Dubosson <fabien.dubosson@gmail.com>
# Contributor: David Manouchehri <david@davidmanouchehri.com>
# Contributor: CHEN Xing <cxcxcxcx@gmail.com>
# Contributor: Martin Imobersteg <martin.imobersteg@gmail.com>
# Contributor: Artyom Smirnov <smirnoffjr@gmail.com>
# Also largely inspired by `opencv` in extra, so including contributors too:
# Contributor: Ray Rashif <schiv@archlinux.org>
@tka
tka / screenshot.js
Last active Jun 3, 2016
phatomjs 2.1 網頁抓圖, 可用 css selector 或是 xpath 抓出區塊
View screenshot.js
"use strict";
var page = require('webpage').create(),
system = require('system'),
address, output, size, pageWidth, pageHeight, targetSelector;
if (system.args.length < 3 || system.args.length > 4) {
console.log('Usage: screenshot.js URL filename [css selector|xpath:path]');
console.log('example: phatomjs screenshot.js https://google.com image.png img');
console.log('example: phatomjs screenshot.js https://google.com image.png xpath://img');
phantom.exit(1);
} else {
@tka
tka / example.aes.source
Last active Aug 29, 2015
load env var from openssl
View example.aes.source
A=123
B=456
C=A1B2C3
FOO=bar
View gist:2b8af4d8d68c8ab4c9cc
Start: Fri Jul 24 16:07:45 2015
HOST: home Loss% Snt Last Avg Best Wrst StDev
1.|-- gateway 0.0% 10 0.3 0.2 0.2 0.3 0.0
2.|-- 175-182-237-1.adsl.dynami 0.0% 10 7.2 7.0 6.8 7.2 0.0
3.|-- h129-192-72-46.seed.net.t 0.0% 10 7.4 7.2 6.8 7.6 0.0
4.|-- R56-137.seed.net.tw 0.0% 10 7.4 7.2 6.9 7.8 0.0
5.|-- R56-158.seed.net.tw 0.0% 10 9.8 8.6 7.7 9.8 0.3
6.|-- h74-192-72-123.seed.net.t 0.0% 10 7.8 7.6 7.3 7.8 0.0
7.|-- 140.111.255.129 0.0% 10 148.4 147.6 146.0 149.0 1.1
View app,assets,javascripts,static_resources.js
function requireAll(r) { r.keys().forEach(r); }
requireAll(require.context('../images/', true, /\..*$/));
requireAll(require.context('./vendors/', true, /\..*$/));
@tka
tka / benchmark.rb
Last active Aug 29, 2015
golang 1.5 shared library + ruby ffi
View benchmark.rb
# 搭配 http://qiita.com/yanolab/items/1e0dd7fd27f19f697285 服用
require 'ffi'
require 'benchmark'
module LibGo
extend FFI::Library
ffi_lib './libgo.so'
attach_function :fib, [:int], :int
View postgres_array.go
package main
import (
"database/sql"
"errors"
"fmt"
_ "github.com/bmizerany/pq"
"os"
"regexp"
"strings"
@tka
tka / test.rb
Last active Aug 29, 2015
大概是這樣
View test.rb
sql = "select *, (select count(books.id) from books where books.authorsid=authors.id) as books_count from authors "
authors = Author.find_by_sql(sql)
authors.first.books_count
View gist:6338785
app = lambda do |env|
request = Rack::Request.new(env)
puts request.inspect
if request.params["t"] == REQUEST_TOKEN
d = JSON.parse(request.body.read)
x=IO.popen([HIPCHAT_SCRIPT, '-t', HIPCHAT_TOKEN, '-f', HIPCHAT_FROM, '-r', HIPCHAT_ROOM],'w+')
if d["event_name"] # system event
x.write("#{d["project_name"]}: #{d["event_name"]} - #{d["user_name"]}")
else
View gist:6223322
config.assets.precompile << Proc.new { |path|
if path =~ /\.(css|js)\z/ && !( File.basename(path) =~ /^\_/ )
full_path = Rails.application.assets.resolve(path).to_path
app_assets_path = Rails.root.join('app', 'assets').to_path
if full_path.starts_with? app_assets_path
puts "including asset: " + full_path
true
else
puts "excluding asset: " + full_path
You can’t perform that action at this time.