Skip to content

Instantly share code, notes, and snippets.

View zlx's full-sized avatar

Newell Zhu zlx

  • Hangzhou, China
View GitHub Profile
@Dayjo
Dayjo / install-poppler-ubuntu.md
Last active February 20, 2024 23:49
How to install Poppler on Ubuntu

First install all these prerequisites for compiling:

sudo apt install g++ autoconf libfontconfig1-dev pkg-config libjpeg-dev libopenjpeg-dev gnome-common libglib2.0-dev gtk-doc-tools libyelp-dev yelp-tools gobject-introspection libsecret-1-dev libnautilus-extension-dev

First download the encoding files (no need to compile these) to the current working directory

wget https://poppler.freedesktop.org/poppler-data-0.4.7.tar.gz
@zlx
zlx / alipay_red_packet.rb
Last active August 29, 2015 14:14
支付宝朋友圈红包识别程序
# 支付宝分享到微信的红包识别
# 依赖:tesseract, gems(mini_magick, rtesseract)
# 使用: ruby alipay_red_packet.rb xxx.jpg
# xxx.jpg 就是支付宝红包图片
require 'mini_magick'
require 'rtesseract'
img = MiniMagick::Image.new(ARGV[0])
img.crop("#{1080-220}x#{1600-1360}+220+1360")
@moiseevigor
moiseevigor / xstat
Last active October 12, 2022 06:32
xstat bash function to get file creation time on Linux with EXT4
xstat() {
for target in "${@}"; do
inode=$(ls -di "${target}" | cut -d ' ' -f 1)
fs=$(df "${target}" | tail -1 | awk '{print $1}')
crtime=$(sudo debugfs -R 'stat <'"${inode}"'>' "${fs}" 2>/dev/null |
grep -oP 'crtime.*--\s*\K.*')
printf "%s\t%s\n" "${crtime}" "${target}"
done
}
@masone
masone / rails
Created August 21, 2014 10:10
Thin with SSL as default server for use with rails server. Works with Rubymine.
#!/usr/bin/env ruby
require 'rack'
# Thin SSL workaround
module Rack
module Handler
class Thin
def self.run(app, options={})
app = Rack::Chunked.new(Rack::ContentLength.new(app))
server = ::Thin::Server.new(options[:Host] || '0.0.0.0',
@snrbrnjna
snrbrnjna / exclude_home.rb
Created November 29, 2013 20:24
To exclude some configurable posts from Jekyll's default pagination on index.html pages
module Jekyll
module Generators
class Pagination
# Monkey patch this method to exclude some cats and tags from all standard
# paginators
#
# For this to take effect, you have to define a ``exclude_home`` property in your _config.yml:
#
# exclude_home:
# categories: [notes]
@senthil245
senthil245 / JDK 1.6 Installation in Ubuntu
Created July 27, 2013 02:16
Step by step installation of JDK 1.6 in Ubuntu
Install Java JDK 6.0 update 31 on Ubuntu 12.04 LTS
Introduction
The first question is why are we installing an old JDK. The answer is that Oracle JDK 6.0 update 31 is the JDK recommended by Cloudera when installing CDH4 (Cloudera Distribution Hadoop v4).
This is an update to an older version of this post. Mainly I have changed the JDK from 1.6.0_26 to 1.6.0_31 as this is the recommended JDK for CDH4 .
Install Java
I have a 64 bit version of Ubuntu 12.04 LTS installed, so the instructions below only apply to this OS.
@nightire
nightire / Changes in Rails 4_1.md
Last active May 11, 2022 04:50
拥抱 Rails 4 —— 详述 Rails 4 的新变化

Routes

小心地使用 Match(Rails 3 已实现)

Rails 3 提供了 match 方法供我们自定义 routes,然而我们要小心使用它以避免“跨站脚本攻击”(XSS Attack)。比如像这样的 routes:

注:(r3 代表 Rails 3,r4 代表 Rails 4)

# routes.rb
Hi David,
I came across your profile online and wanted to reach out about Development
Opportunities here at Groupon. The company is growing, and we're always
looking for folks with solid skills that can make positive contribution to
our continued success. Any chance you'd be open to a quick conversation
about opportunities, or for any possible networking potential? If so, let me
know when you're free and we can set up a time to chat. Also, if you are
interested, it would be great if you could forward a current resume over
that I can take a look at. I look forward to hearing back from you! Please
let me know if you have any questions.