Learn and Be Curious

atom

dev/etc2018. 7. 27. 13:27

source collapse all

ctll + shft + alt + [

https://github.com/atom/atom/issues/10129


'dev > etc' 카테고리의 다른 글

Designing Microservices using Spring Boot, Spring Cloud, Eureka and Zuul  (0) 2017.10.24
vmware hyper-v 충돌  (0) 2017.05.10
타이핑 교정  (0) 2017.04.25

https://www.youtube.com/watch?v=rlS9eH5tEnY







'dev > etc' 카테고리의 다른 글

atom  (0) 2018.07.27
vmware hyper-v 충돌  (0) 2017.05.10
타이핑 교정  (0) 2017.04.25

geth

dev/Blockchain2017. 9. 14. 13:21

C:\Program Files\Geth>geth account new

WARN [09-14|13:18:58] No etherbase set and no accounts found as default

Your new account is locked with a password. Please give a password. Do not forget this password.

Passphrase:

Repeat passphrase:

Address: {a31bef5ee1e5c957f844c2ec05ae8c06c5c30300}


C:\Program Files\Geth>geth account list

Account #0: {a31bef5ee1e5c957f844c2ec05ae8c06c5c30300} keystore://C:\Users\myung-note\AppData\Roaming\Ethereum\keystore\UTC--2017-09-14T04-20-43.152354500Z--a31bef5ee1e5c957f844c2ec05ae8c06c5c30300



MEW 기존 계좌 연동시


 geth account import <keyfile>


  • Open Notepad & paste the private key
  • Save the file as nothing_special_delete_me.txt at C:
  • Run the command, geth account import C:\nothing_special_delete_me.txt
  • This will prompt you to make a new password. This is the password you will use in geth / Ethereum Wallet / Mist whenever you send a transaction, so don't forget it.
  • After successful import, delete nothing_special_delete_me.txt
  • The next time you open the Ethereum Wallet application, your account will be listed under "Accounts".





C:\Program Files\Geth>geth --rpc

INFO [09-14|13:59:23] Starting peer-to-peer node               instance=Geth/v1.6.7-stable-ab5646c5/windows-amd64/go1.8.3

INFO [09-14|13:59:23] Allocated cache and file handles         database=C:\\Users\\myung-note\\AppData\\Roaming\\Ethereum\\geth\\chaindata cache=128 handles=1024

INFO [09-14|13:59:23] Initialised chain configuration          config="{ChainID: 1 Homestead: 1150000 DAO: 1920000 DAOSupport: true EIP150: 2463000 EIP155: 2675000 EIP158: 2675000 Metropolis: 9223372036854775807 Engine: ethash}"

INFO [09-14|13:59:23] Disk storage enabled for ethash caches   dir=C:\\Users\\myung-note\\AppData\\Roaming\\Ethereum\\geth\\ethash count=3

INFO [09-14|13:59:23] Disk storage enabled for ethash DAGs     dir=C:\\Users\\myung-note\\AppData\\Ethash                          count=2

INFO [09-14|13:59:23] Initialising Ethereum protocol           versions="[63 62]" network=1

INFO [09-14|13:59:23] Loaded most recent local header          number=1089 hash=35dc91…a5c5b1 td=24549220618594

INFO [09-14|13:59:23] Loaded most recent local full block      number=0    hash=d4e567…cb8fa3 td=17179869184

INFO [09-14|13:59:23] Loaded most recent local fast block      number=877  hash=804af6…459b30 td=18700125589408

INFO [09-14|13:59:23] Starting P2P networking

INFO [09-14|13:59:25] UDP listener up                          self=enode://7646f5c1cebb3816f2b66b2517487d9a0277e21e6eb4d6d93a21a3f2661c4fc8e3ef07538b0aa6959b672116e6fe3372785bce57b8314575ca34415f2eb7d984@[::]:30303

INFO [09-14|13:59:25] RLPx listener up                         self=enode://7646f5c1cebb3816f2b66b2517487d9a0277e21e6eb4d6d93a21a3f2661c4fc8e3ef07538b0aa6959b672116e6fe3372785bce57b8314575ca34415f2eb7d984@[::]:30303

INFO [09-14|13:59:25] IPC endpoint opened: \\.\pipe\geth.ipc

INFO [09-14|13:59:25] HTTP endpoint opened: http://127.0.0.1:8545





'dev > Blockchain' 카테고리의 다른 글

Ethereum mining at Linux (Ubuntu)  (0) 2017.06.28
개발 모드에서 스마트 컨트랙(체인코드) 개발  (0) 2017.05.21
Hyperledger Fabric Docker 이미지 받기  (0) 2017.05.21
Go  (0) 2017.05.21

● 정의

유니온-파인드(Union-Find) 자료구조 (혹은 Disjoint-Set 자료구조)는 교집합이 존재하지 않는 상호 배타적인 부분집합들로 나누어진 원소들에 대한 정보를 가진 자료구조

● 설명

자료구조에서 제공하는 연산은 두 가지
1. Group (Find) : 어떤 원소가 어느 집합에 속해 있는지를 알려주는 연산
2. Join (Union) : 두 개의 부분집합을 하나의 집합으로 합치는 연산. 즉, 두 개의 원소를 입력으로 주면 그 두 원소가 서로 다른 집합에 속할 경우 그 집합을 하나로 합침

● 예시

시간 복잡도를 대폭 개선하여 가장 널리 사용하고 있는 경로 압축 (Path Compression) 을 이용한 구현법을 소개
초기의 Set 배열 변수는 모두 0 으로 초기화되어 있다고 가정

C++

1
2
3
4
5
6
7
8
9
10
11
12
13
14
// UnionFind.cpp
const int _M_size_ = 1000; // max number of elements 
   
int Set[_M_size_ + 1]; // starts with 1. index 0 is not used. 
   
int group(int n) { 
    if (!Set[n]) return n; 
    return Set[n] = group(Set[n]); // path compression 
   
void join(int a, int b) { 
    int A(group(a)), B(group(b)); 
    if (A != B) Set[A] = B;
}


Java

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// UnionFind.java 
class UnionFind { 
    // max number of elements 
    static final int _M_size_ = 1000
       
    // starts with 1, index 0 is not used. 
    static int Set[] = new int[_M_size_ + 1]; 
       
    static int group(int n) { 
        if(Set[n] == 0) return n; 
        return Set[n] = group(Set[n]); // path compression 
    
       
    static void join(int a, int b) { 
        int A = group(a), B = group(b); 
        if (A != B) Set[A] = B; 
    }


vue.js (1)

dev/front-end2017. 7. 2. 16:13


[index.html]


    
    VueJS Tutirials
    
    
  
  
    

{{ greet('night') }}

website_1

Name : {{ name }}

Job : {{job}}

{{ name }}




[app.js]



new Vue({
  el:'#vue-app',
  data:{
    name:'myung',
    job:'ninja',
    website:'http://jmyung.tistory.com',
    websiteTag:'the myung website'
  },
  methods: {
    greet:function(time) {
      return 'Good ' + time + ' ' + this.name;
    }
  }
});








https://www.youtube.com/watch?v=Ni6qd0uRoKY&list=PL4cUxeGkcC9gQcYgjhBoeQH7wiAyZNrYa&index=2#t=2.99073




app.js

index.html

styles.css




https://www.youtube.com/watch?v=4Gh5YcvGDjI

###Step 1 - Install geth (the Go-Ethereum command line client)

  • Run the following commands to install the latest developer version of go-ethereum
sudo apt-get install software-properties-common
sudo add-apt-repository -y ppa:ethereum/ethereum-qt
sudo add-apt-repository -y ppa:ethereum/ethereum
sudo add-apt-repository -y ppa:ethereum/ethereum-dev
sudo apt-get update
sudo apt-get install ethereum

and type "Y" to install.

###Step 2 - Use geth to download the blockchain

Once you are satisfied with the generation of the Genesis block, you can load it into the clients using this command:

geth 

This command works exclusively with the ubuntu instance we suggested. You will need to say "y" to the Ethereum agreement.

This command will also "download" the full blockchain to your cloud machine before you can start mining. That is why we recommended to get at least 20+ GB of space!

Depending on how far we went into the livenet, this could take several hours (or even a full day!). Be patient :)

  • You will know that geth has finishing catching up with (i.e. downloading) the blockchain when instead of importing - say - 256 blocks at a time
Imported 256 block(s) (0 queued 0 ignored) in 449.34258ms #block_number.

...it will start importing only 1 block at a time...

Imported 1 block(s) (0 queued 0 ignored) in 3.2345ms #block_number.

Also, you can see what is the current block of the livenet by viewing the Ethereum net stats dashboard under the heading Best Block. For example, if under Best Block you have 610,002 and you reach this number in the download process, then you have finished downloading the blockchain.

  • Once this process is completed, you can type ctrl+c to exit geth

###Step 3 - Install the C++ miner (ethminer)

Let's do this, assuming you have done correctly Step 1 (i.e. you have already added the PPA repository):

sudo apt-get update
sudo apt-get install cpp-ethereum 
  • If you get an error because you have not added the PPA repositories, do:
sudo add-apt-repository -y ppa:ethereum/ethereum-qt
sudo add-apt-repository -y ppa:ethereum/ethereum
sudo apt-get update
sudo apt-get install cpp-ethereum 

Note: Do not confuse Eth (the Command Line Interface client of C++ Ethereum) and EthMiner (which is the standalone miner). Both come with the installation package but they are two different things

Note 2: If you were just testing this guide with the free micro instance you have now reached a dead end, in fact you will read this message "modprobe: ERROR: could not insert 'nvidia': No such device" The system is telling you that the gpu, an nvidia graphic card, is missing. So, start over the guide and get the g2.8xlarge instance before proceeding any further.

  • Benchmark ethminer to check that your system is in order: (should give you your current hashrate, roughly 6MH/s)
ethminer -G -M 

###Step 4 - Create a new account on geth

So, once geth has finished its synchronisation with the blockchain, you have to generate a new account. This will be your "wallet", which will store the ether you mine. Your wallet will be stored in the hidden folder ~/.ethereum (in the /keystore subfolder). In the same folder you will find the files of the blockchain.

  • To generate a new account type:
geth account new
  • The system will ask for a 'Passphrase", aka a password. After the password is inputted (twice), you will be given an Address. Back it up in a notepad.

Note: If you lose your keys, you lose access to the account and its ether balance, permanently. Private keys cannot be generated from public ones (obviously) and the password you're asked for when creating the account is just a means to encrypt the private key, not regenerate it. Therefore, remember your password!!!!

  • You can view if the account generation was successful with
geth account list
  • At any time to check your Ether balance:
geth console
> web3.fromWei(eth.getBalance(eth.coinbase), "ether")
6.5
  • For more information on accounts and user interaction with accounts visit the Go-ethereum Wiki - Managing Your Accounts

Step 5 - Run the syncro between the Go and C++ clients and start mining Ether (finally!)

We're going to want both the RPC client (written in Go) and the Miner (written in C++) to run simultaneously. We also want them to run in the background so that in case we drop our SSH connection, the RPC and Miner keep running. To do that, we're going to use a tool called screen.

First lets start the Geth RPC client

screen
geth --rpc console

Then hit control-A, then hit control-D

Now lets start the miner

screen
ethminer -G --opencl-device 0

Then hit control-A then hit control-D.

Enter screen -ls and verify that you have two detached screens running in the background. You can enter back into that screen and check the output by entering screen -x ID_OF_SCREEN. You can exit out re-detach from the screen by entering control-A, then control-D

Note: If you're using the larger g2 instance with 4 GPUs (the 2.8) you may need to start ethminer 4 times, each time adding a --opencl-device <0..3> argument

So, you will need to start ethminer 3 more times with these commands:

ethminer -G --opencl-device 1
ethminer -G --opencl-device 2
ethminer -G --opencl-device 3
  • Now you should be able to see ethminer getting work packages from geth and hopefully even "mined a block" logs in geth.

Note: If you encounter any issue or bug on this part 2 of the guide, please see the notes and comments at Stephan Tual's GPU mining post

'dev > Blockchain' 카테고리의 다른 글

geth  (0) 2017.09.14
개발 모드에서 스마트 컨트랙(체인코드) 개발  (0) 2017.05.21
Hyperledger Fabric Docker 이미지 받기  (0) 2017.05.21
Go  (0) 2017.05.21

http://www.smileforyou.net/?p=112


http://tiveloper.tistory.com/entry/Amazon-RDS-MariaDB-UTF8-%EB%B3%80%EA%B2%BD

'dev > RDB' 카테고리의 다른 글

aws mysql PRIVILEGES  (0) 2017.06.07
faro sql script  (0) 2017.04.03
oracle characterset  (0) 2017.04.03

aws mysql PRIVILEGES

dev/RDB2017. 6. 7. 00:29

mysql> GRANT ALL PRIVILEGES ON *.* TO 'sds'@'ec2-52-79-185-250.ap-northeast-2.compute.amazonaws.com' IDENTIFIED BY 'sds' with grant option;

Query OK, 0 rows affected (0.00 sec)


mysql> FLUSH PRIVILEGES;

Query OK, 0 rows affected (0.00 sec)

'dev > RDB' 카테고리의 다른 글

AWS RDS MariaDB character set 문제  (0) 2017.06.09
faro sql script  (0) 2017.04.03
oracle characterset  (0) 2017.04.03

PS C:\go\src> mkdir github.com\hyperledger


    디렉터리: C:\go\src\github.com


Mode                LastWriteTime         Length Name
----                -------------         ------ ----
d-----     2017-05-21   오전 2:14                hyperledger


PS C:\go\src> cd .\github.com\hyperledger\
PS C:\go\src\github.com\hyperledger> git clone https://github.com/hyperledger/fablic.git
Cloning into 'fablic'...
remote: Repository not found.
fatal: repository 'https://github.com/hyperledger/fablic.git/' not found
PS C:\go\src\github.com\hyperledger> git clone https://github.com/hyperledger/fabric.git
Cloning into 'fabric'...
remote: Counting objects: 37242, done.
remote: Compressing objects: 100% (37/37), done.
remote: Total 37242 (delta 17), reused 34 (delta 14), pack-reused 37191
Receiving objects: 100% (37242/37242), 47.39 MiB | 1.16 MiB/s, done.

Resolving deltas: 100% (21960/21960), done.
Checking out files: 100% (3409/3409), done.
PS C:\go\src\github.com\hyperledger> cd .\fabric\
PS C:\go\src\github.com\hyperledger\fabric> dir






PS C:\go\src\github.com\hyperledger\fabric\examples\chaincode\go\chaincode_example02> docker ps
CONTAINER ID        IMAGE                                                COMMAND                  CREATED             STATUS              PORTS                                                      NAMES
6fa6b88ddb0c        hyperledger/fabric-peer:x86_64-0.6.1-preview         "sh -c 'sleep 5; p..."   30 minutes ago      Up 11 minutes       0.0.0.0:7050-7051->7050-7051/tcp, 0.0.0.0:7053->7053/tcp   blockchain_vp0_1
278f00d3eac7        hyperledger/fabric-membersrvc:x86_64-0.6.1-preview   "membersrvc"             30 minutes ago      Up 11 minutes       0.0.0.0:7054->7054/tcp                                     blockchain_membersrvc_1
PS C:\go\src\github.com\hyperledger\fabric\examples\chaincode\go\chaincode_example02>




C:\Users\myung>set CORE_CHAINCODE_ID_NAME=mycc

C:\Users\myung>set CORE_PEER_ADDRESS=0.0.0.0:7051

C:\Users\myung>cd C:\go\src\github.com\hyperledger\fabric\examples\chaincode\go\chaincode_example02

C:\Go\src\github.com\hyperledger\fabric\examples\chaincode\go\chaincode_example02>chaincode_example02.exe
02:38:09.055 [shim] DEBU : Peer address: 0.0.0.0:7051
02:38:09.056 [shim] DEBU : os.Args returns: [chaincode_example02.exe]
02:38:09.057 [shim] DEBU : Registering.. sending REGISTER
02:38:09.062 [shim] DEBU : []Received message REGISTERED from shim
02:38:09.062 [shim] DEBU : []Handling ChaincodeMessage of type: REGISTERED(state:created)
02:38:09.064 [shim] DEBU : Received REGISTERED, ready for invocations









'dev > Blockchain' 카테고리의 다른 글

geth  (0) 2017.09.14
Ethereum mining at Linux (Ubuntu)  (0) 2017.06.28
Hyperledger Fabric Docker 이미지 받기  (0) 2017.05.21
Go  (0) 2017.05.21

PS C:\Users\myung> docker pull hyperledger/fabric-baseimage:x86_64-0.2.2
x86_64-0.2.2: Pulling from hyperledger/fabric-baseimage
af49a5ceb2a5: Pull complete
8f9757b472e7: Pull complete
e931b117db38: Pull complete
47b5e16c0811: Pull complete
9332eaf1a55b: Pull complete
95bdd37821eb: Pull complete
2af301fab12e: Pull complete
Digest: sha256:b701179a194d9b3a92ec60c9c9eab0bb780c6b1f2c4f6ebf838e1ad351fc9052
Status: Downloaded newer image for hyperledger/fabric-baseimage:x86_64-0.2.2
PS C:\Users\myung> docker pull hyperledger/fabric-membersrvc:x86_64-0.6.1-preview
x86_64-0.6.1-preview: Pulling from hyperledger/fabric-membersrvc
862a3e9af0ae: Pull complete
6498e51874bf: Pull complete
159ebdd1959b: Pull complete
0fdbedd3771a: Pull complete
7a1f7116d1e3: Pull complete
a3ed95caeb02: Pull complete
6c17aabda8d5: Pull complete
619b1ba840e1: Pull complete
18dfa32b9b86: Pull complete
9f4a5f266a0b: Pull complete
fd0590aa11c6: Pull complete
80983e976c3c: Pull complete
7c93717480c9: Pull complete
3814d60b7b34: Pull complete
a0e45c369819: Pull complete
8544aa71916f: Pull complete
Digest: sha256:73a74358605a7861ed068b4cdc18f58ea063c4db5194de2112a5a6f20b19b047
Status: Downloaded newer image for hyperledger/fabric-membersrvc:x86_64-0.6.1-preview
PS C:\Users\myung> docker pull hyperledger/fabric-peer:x86_64-0.6.1-preview
x86_64-0.6.1-preview: Pulling from hyperledger/fabric-peer
862a3e9af0ae: Already exists
6498e51874bf: Already exists
159ebdd1959b: Already exists
0fdbedd3771a: Already exists
7a1f7116d1e3: Already exists
a3ed95caeb02: Pull complete
6c17aabda8d5: Already exists
619b1ba840e1: Already exists
18dfa32b9b86: Already exists
9f4a5f266a0b: Already exists
fd0590aa11c6: Already exists
80983e976c3c: Already exists
7c93717480c9: Already exists
3814d60b7b34: Already exists
a0e45c369819: Already exists
2a84be7a439f: Pull complete
Digest: sha256:bfe5f1e72eff149896575880a4b61e9e74e023c2c7ef3b6807e11f0a182394db
Status: Downloaded newer image for hyperledger/fabric-peer:x86_64-0.6.1-preview






PS C:\Users\myung> docker images
REPOSITORY                      TAG                    IMAGE ID            CREATED             SIZE
hyperledger/fabric-baseimage    x86_64-0.2.2           4ac07a26ca7a        5 months ago        1.24 GB
hyperledger/fabric-membersrvc   x86_64-0.6.1-preview   b3654d32e4f9        7 months ago        1.42 GB
hyperledger/fabric-peer         x86_64-0.6.1-preview   21cb00fb27f4        7 months ago        1.42 GB






'dev > Blockchain' 카테고리의 다른 글

geth  (0) 2017.09.14
Ethereum mining at Linux (Ubuntu)  (0) 2017.06.28
개발 모드에서 스마트 컨트랙(체인코드) 개발  (0) 2017.05.21
Go  (0) 2017.05.21