Skip to content

Instantly share code, notes, and snippets.

Leslie googya

Block or report user

Report or block googya

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
View first_otp.erl
-module(server1).
-export([start/2, rpc/2]).
start(Name, Mod) ->
register(Name, spawn(fun() -> loop(Name, Mod, Mod:init()) end)).
rpc(Name, Request) ->
io:format(" self at rpc is ~p~n", [self()]),
io:format(" Name at rpc is ~p~n", [Name]),
Name ! { self(), Request },
@googya
googya / red_package.rb
Created Nov 9, 2018
简单抢红包实现
View red_package.rb
require 'bigdecimal'
def getRandomMoney(remainSize, remainMoney)
if remainSize == 1
remainSize -= 1
return remainMoney.floor(2)
end
min = 0.01
max = remainMoney / remainSize * 2.0
@googya
googya / demo.gitignore
Created Oct 14, 2018
忽略 rust 运行出来的二进制文件, 但是不忽略源文件
View simple_rabbitmq.rb
##### producer #####
require 'bunny'
require 'pry'
require 'json'
require 'optparse'
options = {}
OptionParser.new do |opts|
opts.on('-r', '--routing_key key', 'Routing key for message') do |key|
@googya
googya / coinfit_api.py
Last active Nov 2, 2018
coinfit.io api request
View coinfit_api.py
import urllib
import hashlib
import time
import hmac
import requests
access_key = "access_key"
secret_key = "secret_key"
url = "/api/orders"
@googya
googya / gist:073123621ac4066659a0d0fb1c92ef03
Created Jun 19, 2018 — forked from giannisp/gist:ebaca117ac9e44231421f04e7796d5ca
Upgrade PostgreSQL 9.6.5 to 10.0 using Homebrew (macOS)
View gist:073123621ac4066659a0d0fb1c92ef03
After automatically updating Postgres to 10.0 via Homebrew, the pg_ctl start command didn't work.
The error was "The data directory was initialized by PostgreSQL version 9.6, which is not compatible with this version 10.0."
Database files have to be updated before starting the server, here are the steps that had to be followed:
# need to have both 9.6.x and latest 10.0 installed, and keep 10.0 as default
brew unlink postgresql
brew install postgresql@9.6
brew unlink postgresql@9.6
brew link postgresql
View lengthOfLongestSubstring.js
var lengthOfLongestSubstring = function(s) {
var longStr = '', curStr = '';
var strArr = s.split('');
for (var i = 0; i < strArr.length; i++) {
if (curStr.indexOf(strArr[i]) == -1) {
curStr += strArr[i];
} else {
idx = curStr.indexOf(strArr[i]);
curStr = curStr.slice(idx+1);
@googya
googya / delayCheck.js
Last active May 3, 2018
轮询检查结果, 下次轮询时长为之前 1.5 倍
View delayCheck.js
function delay(time, fn) {
return new Promise(function(resolve, reject){
function fun () {
resolve(fn())
}
setTimeout(fun, time);
});
}
function checkRes(time = 1000) {
@googya
googya / dabblet.css
Created Apr 26, 2018 — forked from csssecrets/dabblet.css
Translucent borders
View dabblet.css
/**
* Translucent borders
*/
body {
background: url('http://csssecrets.io/images/stone-art.jpg');
}
div {
border: 10px solid hsla(0,0%,100%,.5);
@googya
googya / dabblet.css
Last active Apr 26, 2018
Translucent borders
View dabblet.css
/**
* Translucent borders
*/
body {
background: url('http://csssecrets.io/images/stone-art.jpg');
}
div {
border: 10px solid hsla(0,0%,100%,.5);
You can’t perform that action at this time.