Skip to content

Instantly share code, notes, and snippets.

View suncle1993's full-sized avatar
🎯
Focusing

Suncle Chen suncle1993

🎯
Focusing
View GitHub Profile
@suncle1993
suncle1993 / bank_account.erl
Last active September 20, 2020 15:18
erlang gen_server bank_account
%%%-------------------------------------------------------------------
%%% @author Suncle
%%% @copyright (C) 2017, <COMPANY>
%%% @doc
%%% @end
%%% Created : 13. 十一月 2017 17:19
%%%-------------------------------------------------------------------
-module(bank_account).
-author("Suncle").
-behaviour(gen_server).
@suncle1993
suncle1993 / bank.erl
Created August 30, 2018 07:45
erlang bank example
-module(bank).
-export([start/1,
init/1,
withdraw/1, %% 取款
deposit/1, %% 存款
print/0 %% 打印帐号信息
]).
start(Money) ->
%% spawn,开启进程,并注册进程名为当前模块名
erlang:spawn(?MODULE,init,[Money]).
@suncle1993
suncle1993 / print_server.erl
Created August 30, 2018 07:43
erlang print_server
%%%-------------------------------------------------------------------
%%% @author Suncle
%%% @doc
%%% print_server
%%% @end
%%% Created : 2017/12/18 14:53
%%%-------------------------------------------------------------------
-module(print_server).
-author("Suncle").
@suncle1993
suncle1993 / print_server.go
Created August 30, 2018 07:43
go csp channel print_server
package main
import (
"fmt"
"time"
)
func main() {
c := make(chan string)
go print(c)
@suncle1993
suncle1993 / wordpress_post.py
Created December 13, 2017 07:50
使用python和wordpress_xmlrpc发布wordpress带特征图片的文章
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import re
import datetime
import os
import time
@suncle1993
suncle1993 / getTimeOClock.py
Created December 13, 2017 07:35
1、获取当天0点的时间戳 2、获取指定时间戳所在天0点的时间戳
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import re
import datetime
import os
import time
@suncle1993
suncle1993 / sheet_merge.vb
Created December 13, 2017 06:35
将多个Excel workbook的同名称sheet页(比如sheet也名称为"其他流动资产")合并到一个workbook中
Sub HB()
'定义对话框变量
Dim fd As FileDialog
Set fd = Application.FileDialog(msoFileDialogFilePicker)
'新建一个工作簿
Dim newwb As Workbook
Set newwb = ThisWorkbook
@suncle1993
suncle1993 / dets.erl
Created November 30, 2017 05:41
Erlang dets的使用:增删查遍历
Eshell V7.3 (abort with ^G)
1> dets:open_file(bbb, [{type, bag}]).
{ok,bbb}
2> dets:lookup(bbb, "b11").
[{"b11","b22","b32"},{"b11","b21","b31"}]
3>
3> dets:lookup(bbb, "a11").
[]
4>
4> dets:insert(bbb, {"b11", "b23", "b33"}).
@suncle1993
suncle1993 / curlPOST.md
Created November 16, 2017 11:01
curl post请求

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@suncle1993
suncle1993 / bank_account.erl
Last active November 13, 2017 10:54
erlang gen_server的使用:以银行账户服务为例
%%%-------------------------------------------------------------------
%%% @author Flowsnow
%%% @copyright (C) 2017, <COMPANY>
%%% @doc
%%% http://www.kongqingquan.com/archives/403
%%% @end
%%% Created : 13. 十一月 2017 17:19
%%%-------------------------------------------------------------------
-module(bank_account).
-author("Flowsnow").