Skip to content

Instantly share code, notes, and snippets.

package main
import "fmt"
import "unsafe"
type TerraformResource struct {
Cloud string // 16 Bytes
Name string // 16 Bytes
PluginVersion string // 16 Bytes
TerraformVersion string // 16 Bytes
@brainwire
brainwire / gist:a1791e3cd1a34f75b93f3175eed7c3a1
Created October 18, 2021 04:45 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@brainwire
brainwire / logrotate-puma-rails
Created July 7, 2019 09:50 — forked from iamdbc/logrotate-puma-rails
logrotate for puma on rails
# file location: /etc/logrotate.d
/sitesroot/domain/logfolder/*.log {
su deploy deploy
daily
rotate 7
missingok
dateext
compress
notifempty
@brainwire
brainwire / err.go
Created August 26, 2018 08:43
GoLang Err
var (
ErrSuccess = StandardError{0, "成功"}
ErrUnrecognized = StandardError{-1, "未知错误"}
ErrAccessForbid = StandardError{1000, "没有访问权限"}
ErrNamePwdIncorrect = StandardError{1001, "用户名或密码错误"}
ErrAuthExpired = StandardError{1002, "证书过期"}
ErrAuthInvalid = StandardError{1003, "无效签名"}
ErrClientInnerError = StandardError{4000, "客户端内部错误"}
ErrParamError = StandardError{4001, "参数错误"}
ErrReqForbidden = StandardError{4003, "请求被拒绝"}
class LogHandler
attr_reader :successor
def initialize(successor = nil)
@successor = successor
end
def process(log_item)
if accept(log_item)
@brainwire
brainwire / README-Template.md
Created November 17, 2017 12:34 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

#!/bin/bash
# Bash script to install latest version of ffmpeg and its dependencies on Ubuntu 12.04 or 14.04
# Inspired from https://gist.github.com/faleev/3435377
# Remove any existing packages:
sudo apt-get -y remove ffmpeg x264 libav-tools libvpx-dev libx264-dev
# Get the dependencies (Ubuntu Server or headless users):
sudo apt-get update
@brainwire
brainwire / rds_to_docker.md
Created March 1, 2017 07:04 — forked from herval/rds_to_docker.md
Moving a Postgres db from RDS to a Docker container

Make a backup from RDS

pg_dump -h <rds host> -p 5432 -F c -O -U <rds user> <db name> > db.dump

Restore the backup into a Docker container

docker run --rm --interactive --link <postgres container id>:postgres --volume $PWD/:/tmp/ postgres:latest /bin/bash -c 'pg_restore --verbose --clean --no-acl --no-owner -h "$POSTGRES_PORT_5432_TCP_ADDR" -p "$POSTGRES_PORT_5432_TCP_PORT" -U postgres -d <db name> /tmp/db.dump'
@brainwire
brainwire / UUID.rb
Last active February 9, 2017 20:04
UUIDs
Enabling UUIDs by default in Rails apps is easy. Just edit the config file:
# config/application.rb
config.active_record.primary_key = :uuid
You can use UUIDs for an individual table with Rails migrations:
create_table :users, id: :uuid do |t|
t.string :name
end
@brainwire
brainwire / 00_README.md
Created February 3, 2017 09:08
development server Puma + Listen + FSEvent (macOS) : Fix running too many fsevent_watch processes