Skip to content

Instantly share code, notes, and snippets.

@greenhat
greenhat / DLog.h
Created May 27, 2012 20:02
Logging macros for debug purposes
#ifdef DEBUG
#define DLog( s, ... ) NSLog( @"<%p %@:%@(%d)> %@", self, [[NSString stringWithUTF8String:__FILE__] lastPathComponent],NSStringFromSelector(_cmd), __LINE__, [NSString stringWithFormat:(s), ##__VA_ARGS__] )
#else
#define DLog( s, ... )
#endif
@greenhat
greenhat / postfix.yml
Created February 7, 2016 16:50
Ansible playbook for setting up Postfix
---
- name: set debconf defaults before postfix install
shell: debconf-set-selections <<< "postfix postfix/mailname string {{ hostname }}" executable=/bin/bash
sudo: yes
tags: postfix
- name: set debconf defaults before postfix install
shell: debconf-set-selections <<< "postfix postfix/main_mailer_type string 'Internet Site'" executable=/bin/bash
sudo: yes
tags: postfix
@greenhat
greenhat / postgresql.yml
Created February 7, 2016 16:58
Ansible playbook for PostgreSQL setup
---
- name: install PostgreSQL
apt: pkg={{ item }} update_cache=yes state=present
sudo: yes
tags: postgres
with_items:
- postgresql-{{ postgresql_version }}
- postgresql-client-{{ postgresql_version }}
- postgresql-contrib-{{ postgresql_version }}
- libpq-dev
---
- hosts: app_servers
user: "{{deploy_user}}"
tasks:
- name: Ensure vendor path exists
file: path="{{vendor_path}}" owner="{{deploy_user}}" group="{{deploy_user}}" state=directory
sudo: yes
notify: restart uwsgi
@greenhat
greenhat / ErgoScalaTeaser.md
Last active January 23, 2020 07:47
ErgoScala teaser

I want to share with you a glimpse of the new contract development workflow that we’ve been working on for some time. The idea is to provide the following abilities to the contract developers:

1. Write a contract in Scala subset(ErgoScala) Here is a buyer’s contract from assets atomic exchange example:

def buyer(ctx: Context,
            deadline: Int,
 tokenId: Coll[Byte],
Tx: {
"id": "5d899e1551b324012c6c17636422fceb8077c444585de06f444fe680f9badd92",
"inputs": [
{
"boxId": "d47f958b201dc7162f641f7eb055e9fa7a9cb65cc24d4447a10f86675fc58328",
"spendingProof": {
"proofBytes": "a8e796930fb11cb122bd8a506bd7b7dad38bbe287122580669aa28c36a08f7b5be95bd084878be05b695bfb1753417f45efe1e7647691304",
"extension": {}
}
},
@greenhat
greenhat / dexIssueToken.md
Last active February 27, 2020 12:02
dex:IssueToken output
./ergo-tool dex:IssueToken storage/secret.json 10000000 100 "TT1" "TT1 desc" 2
Storage password>
Creating prover...SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
 Ok
Loading unspent boxes from at address 3WxrCKgrcmS7oPpWXgwuKNiB1JSNEmpyqaXPM1cBrXiJY1jhk4Ep... Ok
Signing the transaction... Ok
Tx: {
@greenhat
greenhat / dexSellOrder.md
Created February 27, 2020 12:05
dex:SellOrder output
./ergo-tool dex:SellOrder storage/secret.json 10000000 "d0105f7469be3ac90f16d943b29133f16c3bf4d85bd754656194cead849baf1e" 3 5000000
Storage password>
Creating prover...SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
 Ok
Loading unspent boxes from at address 3WxrCKgrcmS7oPpWXgwuKNiB1JSNEmpyqaXPM1cBrXiJY1jhk4Ep... Ok
Signing the transaction... Ok
Tx: {
@greenhat
greenhat / dexBuyOrder.md
Created February 27, 2020 12:35
dex:BuyOrder output
./ergo-tool dex:BuyOrder storage/secret.json 10000000 "d0105f7469be3ac90f16d943b29133f16c3bf4d85bd754656194cead849baf1e" 3 5000000
Storage password>
Creating prover...SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
 Ok
Loading unspent boxes from at address 3WxrCKgrcmS7oPpWXgwuKNiB1JSNEmpyqaXPM1cBrXiJY1jhk4Ep... Ok
Signing the transaction... Ok
Tx: {
@greenhat
greenhat / dexListMyOrders.md
Created March 1, 2020 07:26
dex:ShowMyList output
java -jar ../target/scala-2.12/ergotool-3.1.1.jar --conf ergo_tool_config1.json dex:ListMyOrders storage/secret.json
Storage password>
Creating prover...SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
 Ok
Loading seller boxes... Ok
Loading buyer boxes... Ok
Orders created with key 3WxrCKgrcmS7oPpWXgwuKNiB1JSNEmpyqaXPM1cBrXiJY1jhk4Ep :