Skip to content

Instantly share code, notes, and snippets.

View Eric-Guo's full-sized avatar

Eric Guo Eric-Guo

View GitHub Profile
@Eric-Guo
Eric-Guo / nginx
Last active September 24, 2019 19:37
Openresty init.d script
#!/bin/sh
#
# chkconfig: 2345 55 25
# Description: Nginx init.d script, put in /etc/init.d, chmod +x /etc/init.d/nginx
# For Debian, run: update-rc.d -f nginx defaults
# For CentOS, run: chkconfig --add nginx
# if report exist, running update-rc.d -f nginx remove first
#
### BEGIN INIT INFO
# Provides: nginx
@Eric-Guo
Eric-Guo / private.xml
Last active April 28, 2021 00:51 — forked from pjan/private.xml
Karabiner private.xml for Topre REALFORCE 87U on rMBP
<?xml version="1.0"?>
<root>
<item>
<name>For Topre REALFORCE 87u Users</name>
<devicevendordef>
<vendorname>TopreCorporation</vendorname>
<vendorid>0x0853</vendorid>
</devicevendordef>
<item>
<name>Fix FN + F1..F12 and functional keys</name>
config.ignore_if do |exception, options|
# use beginning to prevent non unique keys (they include object ids and such)
key = exception.message.split("for").first[0..30]
ExpirableKey.new(key).exist_with_renew
end
@Eric-Guo
Eric-Guo / qrgen.rb
Created March 13, 2017 09:55
QR Code (二维码)个人名片产生器
#!/usr/bin/ruby
#Developed by proxhotdog on 15 June 2012
#Ruby 1.8.7
#Mac OSX 10.7 Lion
#QR code generator written in ruby
require 'rubygems'
require 'rqrcode_png'
firstname = "Chan" #姓
lastname = "Tai Man" #名
@Eric-Guo
Eric-Guo / add_chinese_text_to_picture.rb
Created March 13, 2017 12:28
Using MiniMagick to add text to a picture
# encoding: utf-8
require 'mini_magick'
image = MiniMagick::Image.open('origin.jpg')
image.combine_options do |c|
c.font '/Library/Fonts/Songti.ttc'
c.pointsize 28
c.gravity 'Center'
c.pointsize '22'
c.draw "text 3,3 'Ruby语言'"
c.fill 'red'
@Eric-Guo
Eric-Guo / add_text_picture.rb
Created March 13, 2017 17:22
Add Chinese text and logo as overlay picture via mini_magick
# encoding: utf-8
require 'mini_magick'
image = MiniMagick::Image.open('origin.jpg')
image.combine_options do |c|
c.font '/Library/Fonts/Songti.ttc'
c.pointsize 38
c.draw "text 360,145 'Ruby语言'"
c.fill 'red'
end
outimage = image.composite(MiniMagick::Image.open('overlay.jpg')) do |c|
@Eric-Guo
Eric-Guo / keybase.md
Created April 18, 2017 00:54
odd verify...

Keybase proof

I hereby claim:

  • I am Eric-Guo on github.
  • I am ericguo (https://keybase.io/ericguo) on keybase.
  • I have a public key whose fingerprint is 3017 E111 4D24 D4AD 19AD 34B3 4631 036D 2383 8650

To claim this, I am signing this object:

var orig = [
[
"Afghanistan (‫افغانستان‬‎)",
"af",
"93"
],
[
"Albania (Shqipëri)",
"al",
"355"
@Eric-Guo
Eric-Guo / .circleci-config.yml
Created September 10, 2017 15:00 — forked from davidwessman/.circleci-config.yml
CircleCI 2.0 setup
version: 2
jobs:
build:
working_directory: ~/mowers
docker:
- image: circleci/ruby:2.4.1-node
environment:
PGHOST: 127.0.0.1
PGUSER: mower
RAILS_ENV: test
@Eric-Guo
Eric-Guo / rails-cookie-decrypt.go
Created September 23, 2017 10:45 — forked from doitian/rails-cookie-decrypt.go
rails session encrypt