Skip to content

Instantly share code, notes, and snippets.

@myrual
myrual / YourOwnFixedToken.sol
Created January 27, 2018 06:23
Create your own token
pragma solidity ^0.4.18;
// ----------------------------------------------------------------------------
// 'FIXED' 'Example Fixed Supply Token' token contract
//
// Symbol : FIXED
// Name : Your own token
// Total supply: 1,000,000,000.000000000000000000
// Decimals : 18
//
https://www.amazon.com/Satechi-7-Port-Charging-Station-Samsung/dp/B00TT9O0SG
https://www.bhphotovideo.com/c/product/1214464-REG/xuma_ucs_7qc2_7_port_usb_charging_station.html
https://www.alibaba.com/product-detail/ORICO-DUA-10P-120W-Aluminum-10_60018673488.html
http://www.avantree.com/usb-charging-station-avantree-powerhouse.html
https://www.eteknix.com/gelid-zentree-usb-charging-station-review/
https://laughingsquid.com/gorillapower-5-port-usb-charging-station-and-power-dock/
https://www.schoolmart.com/shop/ti-nspire-cx-docking-station/
https://www.igeeksblog.com/griffin-multidock-usb-charging-station-for-iphone-ipad-mac/
http://www.strike.com.au/products/Car-Cradle-Mounts/Strike-5-pack-Desktop-Charging-Dock
@myrual
myrual / fastmovie.py
Created September 18, 2017 07:04
Upyun compress video file example
import requests
import upyun
up = upyun.UpYun('dd-doudouapp-com', 'doudouapp', 'doudouapp1234', timeout=30, endpoint=upyun.ED_AUTO)
#up = upyun.UpYun('videopk-heroku-lilin', 'songwenbin', 'songwenbin123', timeout=30, endpoint=upyun.ED_AUTO)
localURL = "https://lin-rails-tt-myrual.c9users.io/"
herokuURL = "https://dry-fjord-76939.herokuapp.com/"
officalURL = "https://dd.doudouapp.com"
rooturl = officalURL
userEmail = "admin@test.com"
userPass = "123456"
@myrual
myrual / upyun_thumbnail.py
Created September 18, 2017 03:05
UpYun generate thumbnail image from video example
import requests
import upyun
up = upyun.UpYun('dd-doudouapp-com', 'doudouapp', 'doudouapp1234', timeout=30, endpoint=upyun.ED_AUTO)
#up = upyun.UpYun('videopk-heroku-lilin', 'songwenbin', 'songwenbin123', timeout=30, endpoint=upyun.ED_AUTO)
localURL = "https://lin-rails-tt-myrual.c9users.io/"
herokuURL = "https://dry-fjord-76939.herokuapp.com/"
officalURL = "https://dd.doudouapp.com"
rooturl = officalURL
@myrual
myrual / gist:c9aebe08a2b02efd940aef5918fd1f0f
Created May 26, 2017 13:45
error log when add weixin gem
I, [2017-05-26T21:42:17.435381 #552] INFO -- : [022e7481-e496-4483-9ac9-2d161f86970d] Started GET "/users/auth/wechat" for 111.163.244.76 at 2017-05-26 21:42:17 +0800
I, [2017-05-26T21:43:02.962683 #552] INFO -- : [953ca5c1-c13b-4a29-8a97-6ffc43bcd7e8] Started GET "/users/auth/wechat/callback?code=031rW51N1XNVD21RI62N1kTg1N1rW51K&state=" for 111.163.244.76 at 2017-05-26 21:43:02 +0800
F, [2017-05-26T21:43:02.964286 #552] FATAL -- : [953ca5c1-c13b-4a29-8a97-6ffc43bcd7e8]
F, [2017-05-26T21:43:02.965771 #552] FATAL -- : [953ca5c1-c13b-4a29-8a97-6ffc43bcd7e8] NoMethodError (undefined method `inject' for nil:NilClass
Did you mean? inspect):
F, [2017-05-26T21:43:02.965814 #552] FATAL -- : [953ca5c1-c13b-4a29-8a97-6ffc43bcd7e8]
F, [2017-05-26T21:43:02.965853 #552] FATAL -- : [953ca5c1-c13b-4a29-8a97-6ffc43bcd7e8] omniauth-oauth2 (1.0.2) lib/omniauth/strategies/oauth2.rb:79:in `deep_symbolize'
[953ca5c1-c13b-4a29-8a97-6ffc43bcd7e8] bonio-omniauth-wechat-oauth2 (0.1.2) lib/omniauth/strategies/wechat.rb:68:in
<!-- start Mixpanel --><script type="text/javascript">(function(e,a){if(!a.__SV){var b=window;try{var c,l,i,j=b.location,g=j.hash;c=function(a,b){return(l=a.match(RegExp(b+"=([^&]*)")))?l[1]:null};g&&c(g,"state")&&(i=JSON.parse(decodeURIComponent(c(g,"state"))),"mpeditor"===i.action&&(b.sessionStorage.setItem("_mpcehash",g),history.replaceState(i.desiredHash||"",e.title,j.pathname+j.search)))}catch(m){}var k,h;window.mixpanel=a;a._i=[];a.init=function(b,c,f){function e(b,a){var c=a.split(".");2==c.length&&(b=b[c[0]],a=c[1]);b[a]=function(){b.push([a].concat(Array.prototype.slice.call(arguments,
0)))}}var d=a;"undefined"!==typeof f?d=a[f]=[]:f="mixpanel";d.people=d.people||[];d.toString=function(b){var a="mixpanel";"mixpanel"!==f&&(a+="."+f);b||(a+=" (stub)");return a};d.people.toString=function(){return d.toString(1)+".people (stub)"};k="disable time_event track track_pageview track_links track_forms register register_once alias unregister identify name_tag set_config reset people.set people.set_once people.i
@myrual
myrual / SH3x.h
Created March 23, 2017 10:32
header file for STH3X
//=============================================================================
// S E N S I R I O N AG, Laubisruetistr. 50, CH-8712 Staefa, Switzerland
//=============================================================================
// Project : SHT3x Sample Code (V1.1)
// File : sht3x.h (V1.1)
// Author : RFU
// Date : 6-Mai-2015
// Controller: STM32F100RB
// IDE : μVision V5.12.0.0
// Compiler : Armcc
import serial
import datetime
serialPortName = raw_input("input serial port:")
localSerial = serial.Serial(serialPortName, 115200)
logfile = open(str(datetime.datetime.now())+'.txt', 'w')
while True:
readout = localSerial.readline()
print(datetime.datetime.now())
print(readout)
@myrual
myrual / gist:6a6bba19dcece9cf4a49fee752fdec08
Created November 14, 2016 05:23
新生大学 元学习课 课后作业
我在新生大学听了xdite讲的元学习课,这是元学习课的课后作业。
认识我的人都知道我是一个软件工程师,大概有14年的编程经验,为如下产品写过软件,电视机,手机里面的sim卡, 苹果手机上的app,若干没有出货的创业失败产品(蓝牙广告机,电子玩具,机器人)。
我自认为是自学能力很强的人,但是在新生大学听了一套元学习课之后,我才意识到我过去的学习方法其实效果不好,如果早早知道这些原理和概念一定会掌握更多的知识和技能。
如果你,打算学习新知识,采用了这种方法应该比我之前的笨方法快5倍。
方法来了。
@import SystemConfiguration.CaptiveNetwork;
- (id)fetchSSIDInfo {
NSArray *ifs = (__bridge_transfer NSArray *)CNCopySupportedInterfaces();
NSLog(@"Supported interfaces: %@", ifs);
NSDictionary *info;
for (NSString *ifnam in ifs) {
info = (__bridge_transfer NSDictionary *)CNCopyCurrentNetworkInfo((__bridge CFStringRef)ifnam);
NSLog(@"%@ => %@", ifnam, info);
if (info && [info count]) { break; }