Short excursion into git --track, --set-upstream and --set-upstream-to.
All examples use the aliases co for checkout and br for branch.
Setup:
$ git clone [email protected]:AKSW/OntoWiki.git
| <?php | |
| class Math { | |
| /** | |
| * The base. | |
| * | |
| * @var string | |
| */ | |
| private static $base = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; |
| <?php | |
| /** | |
| * This function will output a progress bar when using PHP in CLI | |
| * Call progressBar() for each iteration of a loop | |
| * | |
| * http://ascii-table.com/ansi-escape-sequences.php | |
| */ | |
| function progressBar($current=0, $total=100, $label='', $size=50) { | |
| // Don't have to call $current=0 | |
| // Bar status is stored between calls |
Short excursion into git --track, --set-upstream and --set-upstream-to.
All examples use the aliases co for checkout and br for branch.
Setup:
$ git clone [email protected]:AKSW/OntoWiki.git
At some point you’ll find yourself in a situation where you need edit a commit message. That commit might already be pushed or not, be the most recent or burried below 10 other commits, but fear not, git has your back 🙂.
git commit --amendThis will open your $EDITOR and let you change the message. Continue with your usual git push origin master.
| # delete local tag '12345' | |
| git tag -d 12345 | |
| # delete remote tag '12345' (eg, GitHub version too) | |
| git push origin :refs/tags/12345 | |
| # alternative approach | |
| git push --delete origin tagName | |
| git tag -d tagName |
| # taken from http://www.piware.de/2011/01/creating-an-https-server-in-python/ | |
| # generate server.pem with the following command: | |
| # openssl req -new -x509 -keyout server.pem -out server.pem -days 365 -nodes | |
| # run as follows: | |
| # python simple-https-server.py | |
| # then in your browser, visit: | |
| # https://localhost:4443 | |
| import BaseHTTPServer, SimpleHTTPServer | |
| import ssl |
| # This hosts file is brought to you by Dan Pollock and can be found at | |
| # http://someonewhocares.org/hosts/ | |
| # You are free to copy and distribute this file for non-commercial uses, | |
| # as long the original URL and attribution is included. | |
| #<localhost> | |
| 127.0.0.1 localhost | |
| 127.0.0.1 localhost.localdomain | |
| 255.255.255.255 broadcasthost | |
| ::1 localhost |
| import json | |
| def writeToJSONFile(path, fileName, data): | |
| filePathNameWExt = './' + path + '/' + fileName + '.json' | |
| with open(filePathNameWExt, 'w') as fp: | |
| json.dump(data, fp) | |
| # Example | |
| data = {} |
| print_r(sum_the_time('01:20:22', '02:10:00')); // this will give you a result: 03:30:22 | |
| // Credit: https://gist.github.com/robozavri/c7206d8f5d1efe0fa91563db4deebbcd | |
| function sum_the_time($time1, $time2) | |
| { | |
| $times = [$time1, $time2]; | |
| $seconds = 0; | |
| foreach ($times as $time) { | |
| list($hour, $minute, $second) = explode(':', $time); |