Skip to content

Instantly share code, notes, and snippets.

@lengshuiyulangcn
lengshuiyulangcn / mysql.yml
Last active April 5, 2022 05:59
deploy script for mysql on k8s
kind: Deployment
apiVersion: apps/v1
metadata:
name: mysql
labels:
app: mysql
spec:
replicas: 1
selector:
matchLabels:
@lengshuiyulangcn
lengshuiyulangcn / create_account.js
Created March 2, 2018 02:24
nem create account script
var nem = require("nem-sdk").default;
// Create random bytes from PRNG
var rBytes = nem.crypto.nacl.randomBytes(32);
// Convert the random bytes to hex
var privateKey = nem.utils.convert.ua2hex(rBytes);
var keyPair = nem.crypto.keyPair.create(privateKey);
const nem = require("nem-sdk").default;
const address = "TAYFYAEQEV7URQSZZ3J3TRT3N6EYW2PEXTMWLL67";
const fs = require("hexo-fs");
const path = require("path");
hexo.extend.filter.register('after_init', function(){
var normal_endpoint = nem.model.objects.create("endpoint")(nem.model.nodes.defaultTestnet, nem.model.nodes.defaultPort);
nem.com.requests.account.transactions.incoming(normal_endpoint, address).then((res) => {
res.data.map(( d )=>{
if(d.transaction.message.payload){
@lengshuiyulangcn
lengshuiyulangcn / transfer.rb
Last active February 15, 2018 08:18
put your poem on nem testnet
# gem install nem-ruby
# ruby transter.rb your_poem.md
require 'pp'
require 'nem'
Nem.logger.level = Logger::DEBUG
# sender
A_PRIVATE_KEY = 'your_private_key'
0x7607f094E14b51E397c1c843e799fAC954A75C31
@lengshuiyulangcn
lengshuiyulangcn / currency_rate_graph.js
Created May 8, 2017 04:56
an cmd graph of the currency rate
var blessed = require('blessed')
, contrib = require('../index')
const axios = require("axios");
var minY = 11276;
var maxY= 11278;
var screen = blessed.screen()
, transactionsLine = contrib.line(
{ width: 120
, height: 40
@lengshuiyulangcn
lengshuiyulangcn / markdown
Created May 1, 2017 05:00
在工作的同时背单词
### Get word file
write a parser for the words and examples
```
require 'nokogiri'
require 'open-uri'
require 'pry'
require 'JSON'
url = 'http://m.kpedia.jp/p/302-3'
@lengshuiyulangcn
lengshuiyulangcn / wechat_restore_message.py
Last active March 22, 2017 05:02
need redis support
# -*- coding: UTF-8 -*-
import redis
import itchat
import re
from itchat.content import *
import os
import shutil
redis_client = redis.Redis(host='localhost', port=6379, db=0)
@lengshuiyulangcn
lengshuiyulangcn / long_line.rb
Created January 20, 2016 03:26
split long line into several lines with variables
var1 = "variables"
%Q(this is a long line with some #{var1}) <<
%Q(and it should be a line)
@lengshuiyulangcn
lengshuiyulangcn / gist:02cac157677d5fa3163d
Created January 18, 2016 14:12
tokyo_railway_stations.txt
JR山手線,東京,有楽町,新橋,浜松町,田町,品川,大崎,五反田,目黒,恵比寿,渋谷,原宿,代々木,新宿,新大久保,高田馬場,目白,池袋,大塚,巣鴨,駒込,田端,西日暮里,日暮里,鶯谷,上野,御徒町,秋葉原,神田
JR京浜東北線,赤羽,東十条,王子,上中里,田端,西日暮里,日暮里,鶯谷,上野,御徒町,秋葉原,神田,東京,有楽町,新橋,浜松町,田町,品川,大井町,大森,蒲田,川崎,鶴見,新子安,東神奈川,横浜,桜木町,関内,石川町,山手,根岸,磯子,新杉田,洋光台,港南台,本郷台,大船,大宮,さいたま新都心,与野,北浦和,浦和,南浦和,蕨,西川口,川口
JR東海道本線,東京,新橋,品川,川崎,横浜,戸塚,大船,藤沢,辻堂,茅ヶ崎,平塚,大磯,二宮,国府津,鴨宮,小田原,早川,根府川,真鶴,湯河原
JR常磐線,品川,新橋,東京,上野,日暮里,三河島,南千住,北千住,綾瀬,亀有,金町,松戸,北松戸,馬橋,新松戸,北小金,南柏,柏,北柏,我孫子,天王台,取手,藤代,佐貫,牛久,ひたち野うしく,荒川沖,土浦,神立,高浜,石岡,羽鳥,岩間,友部,内原,赤塚,偕楽園,水戸,勝田,佐和,東海,大甕,常陸多賀,日立,小木津,十王,高萩,南中郷,磯原,大津港
JR南武線,矢野口,稲城長沼,南多摩,府中本町,分倍河原,西府,谷保,矢川,西国立,立川,川崎,尻手,八丁畷,川崎新町,浜川崎,矢向,鹿島田,平間,向河原,武蔵小杉,武蔵中原,武蔵新城,武蔵溝ノ口,津田山,久地,宿河原,登戸,中野島,稲田堤
JR横浜線,成瀬,町田,相原,八王子みなみ野,片倉,八王子,東神奈川,大口,菊名,新横浜,小机,鴨居,中山,十日市場,長津田,古淵,淵野辺,矢部,相模原,橋本
JR横須賀線,東京,新橋,品川,西大井,武蔵小杉,新川崎,横浜,保土ヶ谷,東戸塚,戸塚,大船,北鎌倉,鎌倉,逗子,東逗子,田浦,横須賀,衣笠,久里浜
JR中央線,東京,神田,御茶ノ水,水道橋,飯田橋,市ヶ谷,四ツ谷,信濃町,千駄ヶ谷,代々木,新宿,大久保,東中野,中野,高円寺,阿佐ヶ谷,荻窪,西荻窪,吉祥寺,三鷹,武蔵境,東小金井,武蔵小金井,国分寺,西国分寺,国立,立川,日野,豊田,八王子,西八王子,高尾,相模湖,藤野
JR青梅線,立川,西立川,東中神,中神,昭島,拝島,牛浜,福生,羽村,小作,河辺,東青梅,青梅,宮ノ平,日向和田,石神前,二俣尾,軍畑,沢井,御嶽,川井,古里,鳩ノ