Skip to content

Instantly share code, notes, and snippets.

View bantya's full-sized avatar
🎯
Focussing

Rahul Thakare bantya

🎯
Focussing
  • http://127.0.0.1:4200
  • http://127.0.0.1:8080
  • 02:30 (UTC -12:00)
  • X @rkkth
View GitHub Profile
@bantya
bantya / Math.php
Created March 23, 2019 12:51 — forked from jgrossi/Math.php
Math class from Taylor Otwell. Thanks to @brad (captain_jim1@yahoo.com) for the class content.
<?php
class Math {
/**
* The base.
*
* @var string
*/
private static $base = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
@bantya
bantya / php_cli_progressbar.php
Created February 19, 2019 13:10 — forked from zanix/php_cli_progressbar.php
PHP CLI Progress Bar
<?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
@bantya
bantya / README.md
Created February 8, 2019 19:25 — forked from miku/README.md
git --track vs --set-upstream vs --set-upstream-to

README

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 git@github.com:AKSW/OntoWiki.git

@bantya
bantya / git-change-commit-messages.md
Created February 8, 2019 17:05 — forked from nepsilon/git-change-commit-messages.md
How to change your commit messages in Git? — First published in fullweb.io issue #55

How to change your commit messages in 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 🙂.

Not pushed + most recent commit:

git commit --amend

This will open your $EDITOR and let you change the message. Continue with your usual git push origin master.

@bantya
bantya / git-tag-delete-local-and-remote.sh
Created February 7, 2019 19:36 — forked from mobilemind/git-tag-delete-local-and-remote.sh
how to delete a git tag locally and remote
# 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
@bantya
bantya / hosts
Created January 20, 2019 05:51 — forked from consti/hosts
/etc/hosts to block shock sites etc.
# 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
@bantya
bantya / Context.sublime-menu
Created January 15, 2019 14:50 — forked from OdatNurd/Context.sublime-menu
Dirt simple integration to Sublime Merge from Sublime Text
[
{ "command": "smerge_search" },
]
@bantya
bantya / save-file.py
Created January 14, 2019 04:38 — forked from keithweaver/save-file.py
Save JSON file with Python
import json
def writeToJSONFile(path, fileName, data):
filePathNameWExt = './' + path + '/' + fileName + '.json'
with open(filePathNameWExt, 'w') as fp:
json.dump(data, fp)
# Example
data = {}
@bantya
bantya / sumTimes.php
Last active December 20, 2018 19:30 — forked from robozavri/php count sum times
php count sum times
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);