Skip to content

Instantly share code, notes, and snippets.

View huacnlee's full-sized avatar

Jason Lee huacnlee

View GitHub Profile
-- 创建名称为readonly的只读用户:
create user social with password '123456';
-- 然后把在public这个schema下现有的所有表的select权限赋给readobly,并执行下面的SQL命令:
grant select on select tables in schema public to social;
-- 上面的命令只是把现有的表的权限给了readonly用户,如果此时创建了表,readonly用户还是不能读,需要使用下面的SQL把所建表的select权限也给用户readonly:
alter default privileges in schema public grant select on tables to social;
@huacnlee
huacnlee / config.yml
Created December 6, 2018 06:07
CircleCI with Ruby 2.5, Rails 5.2, Yarn, Webpacker, Sass, PostgreSQL, Redis, ElasticSearch full example.
version: 2
jobs:
build:
docker:
- image: circleci/ruby:2.5.3-node-browsers
environment:
RAILS_ENV: test
DATABASE_URL: postgres://postgres@127.0.0.1:5432/rails-test
- image: circleci/postgres:9.6
environment:
#!/usr/bin/sudo sh
## ruby_revealer.sh -- decrypt obfuscated GHE .rb files. 2.0.0 to 2.3.1+.
## From `strings ruby_concealer.so`:
##
## > This obfuscation is intended to discourage GitHub Enterprise customers
## > from making modifications to the VM.
##
## Well, good, as long as its not intended to discourage *me* from doing this!
@notozeki
notozeki / Makefile
Last active March 22, 2023 16:27
An example Ruby extension written in Crystal
CRYSTAL = crystal
UNAME = "$(shell uname -ms)"
LIBRARY_PATH = $(shell brew --prefix crystal-lang)/embedded/lib
LIBS = -levent -lpcl -lpcre -lgc -lpthread
LDFLAGS = -Wl,-undefined,dynamic_lookup
TARGET = crystal_example_ext.bundle
$(TARGET): crystal_example_ext.o
$(CC) -bundle -L$(LIBRARY_PATH) -o $@ $^ $(LIBS) $(LDFLAGS)
@steve-jansen
steve-jansen / README.md
Last active February 23, 2024 22:38
Stop and start Symantec Endpoint Protection on OS X

This script enables you stop and start Symantec Endpoint Protection on OS X

Installation

sudo curl https://gist.githubusercontent.com/steve-jansen/61a189b6ab961a517f68/raw/sep -o /usr/local/bin/sep
sudo chmod 755 /usr/local/bin/sep
sudo chown root:staff /usr/local/bin/sep
@huacnlee
huacnlee / _form.html.erb
Created August 21, 2012 10:55
UpYun 表单上传验证信息 helper 方法,用于生成 input tag
<form action="http://v0.api.upyun.com/rbtest/" method="post" enctype="multipart/form-data">
<%= upyun_form_input_tag(:return_url => new_post_path) %>
<input type="file" name="file" />
<button type="submit">上传图片</button>
</form>
@sekati
sekati / xcode-build-bump.sh
Created July 24, 2012 20:44
Xcode Auto-increment Build & Version Numbers
# xcode-build-bump.sh
# @desc Auto-increment the build number every time the project is run.
# @usage
# 1. Select: your Target in Xcode
# 2. Select: Build Phases Tab
# 3. Select: Add Build Phase -> Add Run Script
# 4. Paste code below in to new "Run Script" section
# 5. Drag the "Run Script" below "Link Binaries With Libraries"
# 6. Insure that your starting build number is set to a whole integer and not a float (e.g. 1, not 1.0)
@huacnlee
huacnlee / rails_template_for_mongoid.rb
Created March 23, 2012 07:34
A custom Rails template for Mongoid.
# coding: utf-8
# This is a Rails init template with MongoDB projects
#
# Mongoid, Devise, Bootstrap, jQuery, Redis, Cells, will_paginate, Carrierwave, simple_form, Settingslogic, Thin
#
# Usage
#
# $ rails new app_name -m https://raw.github.com/gist/2168014
#
@quietcricket
quietcricket / gist:1593632
Created January 11, 2012 07:58
Fuzzy string match objective-c (Levenshtein Distance Algorithm)
-(float)compareString:(NSString *)originalString withString:(NSString *)comparisonString
{
// Normalize strings
[originalString stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
[comparisonString stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
originalString = [originalString lowercaseString];
comparisonString = [comparisonString lowercaseString];
// Step 1 (Steps follow description at http://www.merriampark.com/ld.htm)
@vinioliveira
vinioliveira / Additional Commands
Created June 30, 2011 00:04
Init.d Juggernaut2 script for Ubuntu
$ sudo adduser --system --no-create-home --disabled-login --disabled-password --group juggernaut
$ sudo mv ~/juggernaut2-for-init.d-startup.sh /etc/init.d/juggernaut
$ sudo chmod +x /etc/init.d/juggernaut
$ sudo update-rc.d -f juggernaut defaults