Skip to content

Instantly share code, notes, and snippets.

View divyanshu-in's full-sized avatar
🌏
active

divyanshu divyanshu-in

🌏
active
  • Maxtron Innovations
  • Noida, India
  • 20:04 (UTC +05:30)
View GitHub Profile
@jferrao
jferrao / haversine.kt
Last active August 8, 2024 08:51
Kotlin implementation of the Haversine formula
class Geo(private val lat: Double, private val lon: Double) {
companion object {
const val earthRadiusKm: Double = 6372.8
}
/**
* Haversine formula. Giving great-circle distances between two points on a sphere from their longitudes and latitudes.
* It is a special case of a more general formula in spherical trigonometry, the law of haversines, relating the
* sides and angles of spherical "triangles".
@oanhnn
oanhnn / using-multiple-github-accounts-with-ssh-keys.md
Last active April 14, 2025 13:03
Using multiple github accounts with ssh keys

Problem

I have two Github accounts: oanhnn (personal) and superman (for work). I want to use both accounts on same computer (without typing password everytime, when doing git push or pull).

Solution

Use ssh keys and define host aliases in ssh config file (each alias for an account).

How to?

  1. Generate ssh key pairs for accounts and add them to GitHub accounts.
@cspanring
cspanring / pip-install-gdal.md
Last active April 10, 2025 18:08
Installing GDAL in a Python virtual environment

Installing GDAL in a Python virtual environment

Get gdal development libraries:

$ sudo apt-add-repository ppa:ubuntugis/ubuntugis-unstable
$ sudo apt-get update
$ sudo apt-get install libgdal-dev

Create and activate a virtual environment:

@sanchitgangwar
sanchitgangwar / snake.py
Created March 22, 2012 12:38
Snakes Game using Python
# SNAKES GAME
# Use ARROW KEYS to play, SPACE BAR for pausing/resuming and Esc Key for exiting
import curses
from curses import KEY_RIGHT, KEY_LEFT, KEY_UP, KEY_DOWN
from random import randint
curses.initscr()
win = curses.newwin(20, 60, 0, 0)