Skip to content

Instantly share code, notes, and snippets.

View AnweshGangula's full-sized avatar

Anwesh Gangula AnweshGangula

View GitHub Profile
@AnweshGangula
AnweshGangula / Prime Numbers - Visualization.md
Last active December 17, 2020 10:04
Prime Numbers - Visualization (p5js)
@AnweshGangula
AnweshGangula / Prime Numbers viz.py
Created December 17, 2020 10:05
Prime Numbers - Visualization (python)
# This is just an additional file. This is an alternative for p5.js script
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
def check_prime(num):
if num > 1:
for i in range(2,num):
if (num % i) == 0:
@AnweshGangula
AnweshGangula / PowerShell Notification.ps1
Created May 6, 2021 17:43
Show Windows 10 Balloon comments
# Show Windows 10 Balloon comments
[void] [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
$objNotifyIcon = New-Object System.Windows.Forms.NotifyIcon
while($True)
{
$objNotifyIcon.Icon = [System.Drawing.SystemIcons]::Information
$objNotifyIcon.BalloonTipIcon = "Info"
$objNotifyIcon.BalloonTipText = "wzzup this is a title."
@AnweshGangula
AnweshGangula / firstNprimes.py
Created July 3, 2021 19:43
Fastest way to get first n prime numbers
def historic(n):
# Reference: https://stackoverflow.com/a/1638415/6908282
def prime(i, primes):
for prime in primes:
if not (i == prime or i % prime):
return False
primes.add(i)
return i
primes = set([2])
@AnweshGangula
AnweshGangula / bookmarklet to Share Selection
Last active July 21, 2021 12:40
Bookmarklet to share URL of selected text in webpage
javascript:(selection=document.getSelection().toString().replaceAll("\n","%0A").replaceAll(" ","%20"),thisURL=window.location.href,newURL=`${thisURL}#:~:text=${selection}`,window.location.href=newURL;)
@AnweshGangula
AnweshGangula / git-pushing-multiple.rst
Created January 11, 2022 18:35 — forked from rvl/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

library(rayshader)
library(rayrender)
popdata = raster::raster("gpw_v4_population_density_rev11_2020_15_min.tif")
population_mat = rayshader:::flipud(raster_to_matrix(popdata))
above1 = population_mat > 1
above5 = population_mat > 5
above10 = population_mat > 10
@AnweshGangula
AnweshGangula / highlightMyAnswer.js
Last active June 29, 2022 14:31
Highlight Current Users Answer in Stack overflow
// Copy paste this code in the browser console to add border to any answer posted by you and sort it to the top
function insertAfter(referenceNode, newNode) {
// reference: https://stackoverflow.com/a/4793630/6908282
referenceNode.parentNode.insertBefore(newNode, referenceNode.nextSibling);
}
currUser = document.getElementsByClassName("s-user-card")[0];
allAnswers = document.getElementsByClassName('answer');
answersHeader = document.getElementById('answers-header');
@AnweshGangula
AnweshGangula / convertLinks2Ref.js
Created September 20, 2022 16:43
Convert Markdown inline links to references
// Reference: https://stackoverflow.com/a/73790035/6908282
// node convertLinks2Ref.js ReadMe.md RefLinks.md
import * as fs from 'fs'
fs.readFile(process.argv[2], 'utf8', function (err, mainMarkdown) {
if (err) {
return console.log(err);
}
let newMarkdown = existingRefLinks(mainMarkdown);
@AnweshGangula
AnweshGangula / README.md
Created September 27, 2022 09:47 — forked from magnetikonline/README.md
Extract all files at every commit of a Git repository.

Extract all files at every commit of a Git repository

Bash script to iterate all commits of a given Git repository and extract all files within each commit.

Example

With a Git repository at /path/to/repository and an empty directory at /path/to/output we can run:

./export.sh /path/to/repository /path/to/output