Skip to content

Instantly share code, notes, and snippets.

@sadysnaat
sadysnaat / cliargumentdemo.py
Created April 23, 2016 10:39
Use command line arguments in python script
import sys
# Read this
# https://docs.python.org/2/library/sys.html#sys.argv
# you can use
report = sys.argv[1]
# this way first argument that is passed
# to the script will be report location
# If you are further instersted you can use
@sadysnaat
sadysnaat / commandpromptinput.py
Created April 23, 2016 11:38
Use command prompt for user input
import os.path
# https://docs.python.org/2/library/functions.html#raw_input
report = raw_input("Please enter report location: ").strip()
# You can't always begin your programming flow with the
# input user has provided. It is better to check user input.
# In this case here is one useful check
if not os.path.isfile(report):
set -sg escape-time 1
set -g prefix C-a
set -g base-index 1
set -g pane-base-index 1
bind | split-window -h
bind - split-window -v
bind r source-file ~/.tmux.conf \; display "Configuration Reloaded"
bind C-a send-prefix
bind h select-pane -L
bind j select-pane -D
#
# Powerline Double Cyan - Tmux Theme
# Created by Jim Myhrberg <contact@jimeh.me>.
#
# Inspired by vim-powerline: https://github.com/Lokaltog/powerline
#
# Requires terminal to be using a powerline compatible font, find one here:
# https://github.com/Lokaltog/powerline-fonts
#

Keybase proof

I hereby claim:

  • I am sadysnaat on github.
  • I am sadysnaat (https://keybase.io/sadysnaat) on keybase.
  • I have a public key ASC8wMKuua-W15miGICwgHzupsHPFBoSL60E63PI8EJupAo

To claim this, I am signing this object:

@sadysnaat
sadysnaat / trustset.js
Last active November 7, 2016 11:30
Example Trustset Transaction
{
"TransactionType": "TrustSet",
"Account": "r3H4Et5wbJbsB2AiibTZorSDzYmwkisEBD", // Account which is extending the trust
"LimitAmount": {
"currency": "INR", // currency to which this trustline applies
"issuer": "rMvb6PZYzh5dAXGb2WqGsEzVnWmLgQEyf1", // counterparty for this trustline Bank/Gateway ripple address
"value": "1000" // maximim amount to trust
}
"Flags": 131072, // tfSetNoRipple sets NoRipple flag
// For more options go to https://ripple.com/build/transactions/#trustset
@sadysnaat
sadysnaat / bank_trustline.js
Created November 7, 2016 12:09
Bank's trustline view
{
"account": "r3H4Et5wbJbsB2AiibTZorSDzYmwkisEBD",
"balance": "-500", // Debt obligations are shown in negative
"currency": "INR",
"limit": "0",
"limit_peer": "1000", // Total limit trustline
"no_ripple": true,
"no_ripple_peer": true,
"quality_in": 0,
"quality_out": 0
@sadysnaat
sadysnaat / user_trustline.js
Created November 7, 2016 12:13
User's trustline view
{
"account": "rMvb6PZYzh5dAXGb2WqGsEzVnWmLgQEyf1",
"balance": "500", // Balance issued by Bank/Gateway
"currency": "XYZ",
"limit": "1000",
"limit_peer": "0",
"no_ripple": true,
"no_ripple_peer": true,
"quality_in": 0,
"quality_out": 0
@sadysnaat
sadysnaat / success.json
Created February 9, 2017 11:24
This transaction got written to bigchain table
{
"block": {
"node_pubkey": "8LiaunLxeP4fDDaiyLgGfpvraHziyvqqsJ72MbqLpoZN" ,
"timestamp": "1486638484" ,
"transactions": [
{
"asset": {
"data": {
"amount": "12" ,
"asset": "Cheque" ,
@sadysnaat
sadysnaat / Failure.json
Created February 9, 2017 11:26
This transaction keeps getting reassigned.
{
"asset": {
"data": {
"amount": "123" ,
"asset": "Cheque" ,
"currency": "INr" ,
"payee": "abc"
} ,
"id": "2e03ed2a-0e3b-487e-b1a9-4b88efba75f5"