// How to run it | |
// Requires nodejs LTS, git, python2 | |
// Open command line and move to the folder where this script is stored | |
// Edit the script and modify storage location (line 87) | |
// Check the startDate and EndDate and modify it if you need another timeframe (line 102 - 103) | |
// Stop the farmer | |
// Execute "npm install storj-lib" | |
// Execute "node Storj_Farmer_Contracts.js" | |
// Start the farmer |
- Bash/zsh completion
- use Tab to populate command line, narrows down options as you go, fills in container names, ID's, images, volumes. Huge time saver.
#!/bin/bash | |
#no PATH, no way to accidently run any programs | |
PATH='' | |
#useful variables | |
term_height=0 | |
term_width=0 | |
term_scroll_height=0 | |
status_line_row=0 |
Let's say you have a Bash shell script, and you need to run a series of operations on another system (such as via ssh). There are a couple of ways to do this.
First, you can stage a child script on the remote system, then call it, passing along appropriate parameters. The problem with this is you will need to manually keep the remote script updated whenever you change it -- could be a bit of a challenge when you have something to execute on a number of remote servers (i.e., you have a backup script running on a central host, and it needs to put remote databases in hot backup mode before backing them up).
Another option is to embed the commands you want to run remotely within the ssh command line. But then you run into issues with escaping special characters, quoting, etc. This is ok if you only have a couple commands to run, but if it is a complex piece of Bash code, it can get a bit unwieldy.
So, to solve this, you can use a technique called rpcsh -- rpc in shell script, as follows:
First, place th
#!/usr/bin/python | |
# -*- coding: utf-8 -*- | |
import subprocess | |
__all__ = ["transform"] | |
__version__ = '0.3' | |
__author__ = 'Christoph Burgmer <cburgmer@ira.uka.de>' | |
__url__ = 'http://github.com/cburgmer/upsidedown' |
// this is the background code... | |
// listen for our browerAction to be clicked | |
chrome.browserAction.onClicked.addListener(function (tab) { | |
// for the current tab, inject the "inject.js" file & execute it | |
chrome.tabs.executeScript(tab.ib, { | |
file: 'inject.js' | |
}); | |
}); |
THIS GIST WAS MOVED TO TERMSTANDARD/COLORS
REPOSITORY.
PLEASE ASK YOUR QUESTIONS OR ADD ANY SUGGESTIONS AS A REPOSITORY ISSUES OR PULL REQUESTS INSTEAD!
- Learn Python the Hard Way - Great introductory course to python and programming
- The Python Guide - After you have a cursory idea of python, this is great
- Code Like a Pythonista: Idiomatic Python - For learning the "pythonic" way of doing things
- Tango with Django - Great intro to building python web applications
- Intro to Flask, TDD, and jQuery
- Selenium's Page Object Pattern for testing websites
- The Python Yield Keyword Explained - Good precursor to the generator tricks
- Incredible guide on Python's __ (underscore) methods - Must read for anyo