Skip to content

Instantly share code, notes, and snippets.

View basaks's full-sized avatar

Sudipta Basak basaks

  • Geoscience Australia
  • Sydney
View GitHub Profile
@jagregory
jagregory / gist:710671
Created November 22, 2010 21:01
How to move to a fork after cloning
So you've cloned somebody's repo from github, but now you want to fork it and contribute back. Never fear!
Technically, when you fork "origin" should be your fork and "upstream" should be the project you forked; however, if you're willing to break this convention then it's easy.
* Off the top of my head *
1. Fork their repo on Github
2. In your local, add a new remote to your fork; then fetch it, and push your changes up to it
git remote add my-fork [email protected]
@randomecho
randomecho / australian-postcodes.sql
Last active October 30, 2024 04:02
Australian postcodes (with states and suburb names) geocoded with latitude and longitude.
/*
Taken and cribbed from blog.datalicious.com/free-download-all-australian-postcodes-geocod
May contain errors where latitude and longitude are off. Use at own non-validated risk.
*/
SET NAMES utf8;
SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
DROP TABLE IF EXISTS postcodes_geo;
@joe-jordan
joe-jordan / cycles.py
Created September 13, 2013 08:23
Function to find all the cycles in a networkx graph. Health warning: this thing is an NP-complete depth-first search, work hard to make the graphs you put into it small.
def find_all_cycles(G, source=None, cycle_length_limit=None):
"""forked from networkx dfs_edges function. Assumes nodes are integers, or at least
types which work with min() and > ."""
if source is None:
# produce edges for all components
nodes=[i[0] for i in nx.connected_components(G)]
else:
# produce edges for components with source
nodes=[source]
# extra variables for cycle detection:
@pedrovanzella
pedrovanzella / mpi_sort.py
Last active November 22, 2017 22:24
Sort a number of random arrays using MPI
#!/usr/bin/ENV python
import numpy
from mpi4py import MPI
NUMARRAYS = 100
ARRAYSIZE = 10000
ASK_FOR_WORK_TAG = 1
WORK_TAG = 2
WORK_DONE_TAG = 3
@mojodna
mojodna / README.md
Last active May 17, 2024 12:53
GDAL 2.0 on Amazon Linux
sudo yum -y update
sudo yum-config-manager --enable epel
sudo yum -y install make automake gcc gcc-c++ libcurl-devel proj-devel geos-devel
cd /tmp
curl -L http://download.osgeo.org/gdal/2.0.0/gdal-2.0.0.tar.gz | tar zxf -
cd gdal-2.0.0/
./configure --prefix=/usr/local --without-python
make -j4
sudo make install

Push an individual file from a repo to a new repo and keep command history associated with that file:

git clone <original repo url> temp-repo
cd temp-repo
git remote rm origin
git rm -rf .
git checkout HEAD -- <filename>
git commit -m "<commit message>"
git remote add origin <new repo url> # comments
git pull 
@rastermanden
rastermanden / install-gdal.sh
Created March 28, 2018 10:03
install gdal with python amazon AMI
sudo yum-config-manager --enable epel
sudo yum install gdal-python
sudo yum -y update
sudo yum -y install make automake gcc gcc-c++ libcurl-devel proj-devel geos-devel
cd /tmp
curl -L http://download.osgeo.org/gdal/2.2.4/gdal-2.2.4.tar.gz | tar zxf -
cd gdal-2.2.4/
./configure --prefix=/usr/local --with-python
make -j4
sudo make install