Skip to content

Instantly share code, notes, and snippets.

@renie
renie / terminalCryptocoinTicker.js
Last active January 27, 2021 23:03
Simple script to get last prices for a list of currencies on CoinMarketCap.com. Export your API KEY as COINMARKETCAP_APIKEY variable to your environment. Fiat and crypto lists can be changed in the beginning of the file.
const https = require('https')
// ======================================
// ============ SETTINGS ================
// ======================================
const fiatList = ['USD', 'BRL']
const cryptoList = ['DASH', 'LTC', 'ETH', 'BTC']
const url = 'https://pro-api.coinmarketcap.com/v1/cryptocurrency/quotes/latest'
const options = {
const sameAsNextIndex = (item, index, array) => item === array[index + 1]
const sameAsPrevIndex = (item, index, array) => item === array[index - 1]
const isDuplicatedOnSortedMapper =
(item, index, array) =>
sameAsNextIndex(item, index, array)
? item
: sameAsPrevIndex(item, index, array)
? item
: null
#!/bin/bash
#####
# IMPORTANT!
# - Install rsync and inotify-tools
# - For better usage, config your ssh conections and keys
#####
if [ $# -lt 3 ]; then
echo "An origin path, a destination path and a user@server must be set (in this order)."
#!/usr/bin/nodejs
var DEFAULT_CURRENCY_PAIR = 'USDT_DASH';
var DEFAULT_CURRENCY_PROPERTY = 'last';
/*============================================*/
/*============================================*/
/*============================================*/
@renie
renie / .vimrc
Last active August 17, 2016 14:05
set nocompatible
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
Plugin 'bling/vim-airline'
Plugin 'tpope/vim-fugitive'
Plugin 'pangloss/vim-javascript'
@renie
renie / gist:287e4d00fed74ff6ceda
Last active August 29, 2015 14:20
cache ajax
/*
*
*
*
* WILL BE MOVED SOON
* USE THIS => https://github.com/renie/CacheRequest
*
*
*
*
@renie
renie / gist:6214708
Last active December 20, 2015 23:48
Just numbers on html input
onkeyup="this.value = isNaN(this.value.substr(this.value.length-1>0?this.value.length-1:0, this.value.length-1>1?this.value.length-1:1))?(this.value.length<2?"":this.value.substr(0,this.value.length-1)).replace(/\s+/g,""):this.value.replace(/\s+/g,"")"
onkeypress="this.value = isNaN(this.value.substr(this.value.length-1>0?this.value.length-1:0, this.value.length-1>1?this.value.length-1:1))?(this.value.length<2?"":this.value.substr(0,this.value.length-1)).replace(/\s+/g,""):this.value.replace(/\s+/g,"")"
@renie
renie / gist:6143303
Last active December 20, 2015 13:59
mask for brazillian cellphone. NOT TESTED YET!
function mascara(field,callback){
v_obj=field;
v_fun=callback;
setTimeout("executeMask()",1)
}
function executeMask(){
v_obj.value=v_fun(v_obj.value);
}
@renie
renie / runtimeCounting.java
Created June 24, 2013 20:29
Runtime counting
// start method
long startFullTime = System.currentTimeMillis();
//step1 begin
long startStep1Time = System.currentTimeMillis();
// some logic of step 1 here
long endStep1Time = System.currentTimeMillis();
//step1 end
@renie
renie / checkCustom
Created April 30, 2013 19:30
A simple custom checkbox using a random image.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>Document</title>
<style>
*{ padding: 0; margin: 0; font-family: "Helvetica Neue",Helvetica,Arial,sans-serif; }
input[type='checkbox'] { opacity: 0; width: 18px; float: left; }
input[type='checkbox'] + label { clear: none; padding: 2px 2px 2px 19px; cursor: pointer; background: url(./img/ico-uncheck.png) left 5px no-repeat; border: 1px dotted transparent; }
input[type='checkbox']:focus + label,