For this example, I had a collection of text files with embedded mode lines to setup the mode for org-mode. I wanted to do away with the mode line and rename them from txt files to org files.
Build the GLOB before hand and verify with ls. For example ls *.txt would have the GLOB value in the example replaced with *.txt.
The git mv renames the files.
for i in $(find . -iname "GLOB"); do
git mv "$i" "$(echo $i | rev | cut -d '.' -f 2- | rev).org";
done
Continue reading →
Update to Java 1.8 on EC2
sudo yum install java-1.8.0- sudo yum remove java-1.7.0-openjdk
The site Etherscan allows you retrieve information on accounts and transactions. There is an interface to the Reposten testnet as well. While doing some work on a project I was monitoring the page to view an account balance and ended up creating a script to do the monitoring programmatically.
The repo listed at the bottom of the page contains the python script which simply parses the page and returns the balance.
The main routine after figuring out which chain the user wants to look at and which account is the get_balance routine. It parses the page and finds the balance in the first table's first row, second cell.
def get_balance(url):
html = requests.get(url, headers={'User-agent': 'Mozilla/5.0'}).text
soup = BeautifulSoup(html, "html.parser")
table = soup.find("table", {"class" : "table"})
value = table.findAll('td')[1].text.split(' ')[0].strip()
return value
Continue reading →
Had a ton of pdf files in numerous sub-directories. The goal was to collect them into a single directory
$ DEST="directory where you want to collect your pdf files"
$ find . -type f -name \*.pdf -exec cp \{\} $DEST \;
Continue reading →
So the day after writing a post about working in multiple languages I find myself in front of Node writing in JavaScript. Nothing big to start.
I was writing things in a file and then executing them with node file.js when I decided it was time to work inside the Node repl.
For this the question became how do you load your file and have access to the functions and variables.
The answer:
Continue reading →