Skip to content

Instantly share code, notes, and snippets.

@Nilpo
Nilpo / git-pushing-multiple.rst
Created February 2, 2019 02:27 — forked from KJoke70/git-pushing-multiple.rst
How to push to multiple git remotes at once. Useful if you keep mirrors of your repo.

Pushing to Multiple Git Repos

If a project has to have multiple git repos (e.g. Bitbucket and Github) then it's better that they remain in sync.

Usually this would involve pushing each branch to each repo in turn, but actually Git allows pushing to multiple repos in one go.

If in doubt about what git is doing when you run these commands, just

@Nilpo
Nilpo / user-profile.cmd
Created September 16, 2018 15:52 — forked from lukescammell/user-profile.cmd
This enables portable SSH keys in cmder, enabling you to have full SSH access using cmder portably on a USB (for example). Please note that when you ssh-keygen, it will still default to %USERPROFILE%, so you will either have to change the path on generation, or manually move the keys to your %CMDER_ROOT%\config\.ssh directory.
:: use this file to run your own startup commands
:: use in front of the command to prevent printing the command
:: call "%GIT_INSTALL_ROOT%/cmd/start-ssh-agent.cmd"
:: set "PATH=%CMDER_ROOT%\vendor\whatever;%PATH%"
:: LS 2017-09-12_17.35.11
:: ======================
:: Copied from %CMDER_ROOT%\vendor\init.bat
@Nilpo
Nilpo / psql-with-gzip-cheatsheet.sh
Created February 4, 2018 09:16 — forked from brock/psql-with-gzip-cheatsheet.sh
Exporting and Importing Postgres Databases using gzip
# This is just a cheat sheet:
# On production
sudo -u postgres pg_dump database | gzip -9 > database.sql.gz
# On local
scp -C production:~/database.sql.gz
dropdb database && createdb database
gunzip < database.sql.gz | psql database
@Nilpo
Nilpo / gist:52eda0bf40fddec539aa4ac4bb0ecc2c
Created September 9, 2017 06:07 — forked from cdown/gist:1163649
Bash urlencode and urldecode
urlencode() {
# urlencode <string>
old_lc_collate=$LC_COLLATE
LC_COLLATE=C
local length="${#1}"
for (( i = 0; i < length; i++ )); do
local c="${1:i:1}"
case $c in
[a-zA-Z0-9.~_-]) printf "$c" ;;
@Nilpo
Nilpo / flask-logging-on-heroku.py
Last active July 9, 2017 03:45 — forked from seanbehan/flask-logging-on-heroku.py
logging on heroku with flask
import os
import sys
import logging
from flask import Flask
app = Flask(__name__)
if 'DYNO' in os.environ:
app.logger.addHandler(logging.StreamHandler(sys.stdout))
app.logger.setLevel(logging.ERROR)
@Nilpo
Nilpo / proxy.apache.conf
Created June 26, 2017 01:23 — forked from chrisjhoughton/proxy.apache.conf
Sample Nginx reverse proxy to Apache set up for Wordpress.
<VirtualHost *:{PORT}>
ServerName www.yourdomain.com
ServerAdmin mail@domain.com
DocumentRoot /var/www/yourdir/
<Directory /var/www/yourdir>
Options Indexes FollowSymLinks
AllowOverride all
Order allow,deny
//Add before making a phone call
if (ActivityCompat.checkSelfPermission(
MainActivity.this, Manifest.permission.CALL_PHONE)
!= PackageManager.PERMISSION_GRANTED) {
if (ActivityCompat.shouldShowRequestPermissionRationale(MainActivity.this,
Manifest.permission.CALL_PHONE)) {
Toast.makeText(MainActivity.this, "I know you said no, but I'm asking again", Toast.LENGTH_SHORT).show();
}
ActivityCompat.requestPermissions(MainActivity.this,
new String[]{Manifest.permission.CALL_PHONE},
<!-- country codes (ISO 3166) and Dial codes. -->
<select name="countryCode" id="">
<option data-countryCode="GB" value="44" Selected>UK (+44)</option>
<option data-countryCode="US" value="1">USA (+1)</option>
<optgroup label="Other countries">
<option data-countryCode="DZ" value="213">Algeria (+213)</option>
<option data-countryCode="AD" value="376">Andorra (+376)</option>
<option data-countryCode="AO" value="244">Angola (+244)</option>
<option data-countryCode="AI" value="1264">Anguilla (+1264)</option>
<option data-countryCode="AG" value="1268">Antigua &amp; Barbuda (+1268)</option>
@Nilpo
Nilpo / material_design_guidelines_dimens.xml
Created October 17, 2016 02:42 — forked from aeroechelon/material_design_guidelines_dimens.xml
Recommended Material Design Dimensions for Android
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!--
# Material Design Dimensions
These dimensions are provided as per Material Design Guidelines
to adhere to a 8 dp baseline grid. (With the exception of the
toolbar and notification bar.)
Using these dimensions lessens the use of arbitrary dimension