Skip to content

Instantly share code, notes, and snippets.

View neon-ninja's full-sized avatar
🔥
shader compilation intensifies

Nick Young neon-ninja

🔥
shader compilation intensifies
View GitHub Profile
@neon-ninja
neon-ninja / gplus_scrape.py
Last active September 23, 2015 00:19
G+ member scraper
from bs4 import BeautifulSoup
f = open("page.html", "r")
soup = BeautifulSoup(f, 'html.parser')
people = soup.find_all("div", class_="xTc")
for person in people:
name = person.find("span", class_="VCc").text
image = "https:" + person.find("img").get("src")
link = "https://plus.google.com/u/0/" + person.get("data-id")
print "{}\t{}\t{}".format(image,name.encode('utf-8'),link)
@neon-ninja
neon-ninja / iitc-player-tracker-names.user.js
Created January 11, 2016 03:28
IITC Player Tracker Names
// ==UserScript==
// @id iitc-player-tracker-names
// @name IITC Player Tracker Names
// @category Tweaks
// @version 1.0
// @description This plugin displays player names for player tracker
// @include https://www.ingress.com/intel*
// @include http://www.ingress.com/intel*
// @match https://www.ingress.com/intel*
// @match http://www.ingress.com/intel*
@neon-ninja
neon-ninja / iitc-player-tracker-names-alt.user.js
Last active October 6, 2019 19:35
IITC Player Tracker Names leaflet label version
// ==UserScript==
// @id iitc-player-tracker-names-alt
// @name IITC Player Tracker Names
// @category Tweaks
// @version 1.0
// @description This plugin displays player names for player tracker
// @include https://www.ingress.com/intel*
// @include http://www.ingress.com/intel*
// @match https://www.ingress.com/intel*
// @match http://www.ingress.com/intel*
@neon-ninja
neon-ninja / decimate.py
Created March 16, 2018 04:42
Blender script to load in an FBX then decimate all meshes it contains
import bpy
import sys
import time
argv = sys.argv
argv = argv[argv.index("--") + 1:] # get all args after "--"
if len(argv) < 2:
print("Give arguments -- fbx_file decimate_ratio")
@neon-ninja
neon-ninja / elevation.R
Last active October 17, 2019 21:56
fetch NZ 8m DEM elevation with R
library(httr)
library(jsonlite)
#points = as.matrix(read.csv("test_data/6555.csv"))
#points = matrix(c(-36.8772519,174.7654017,-36.877,174.444), ncol=2, byrow=T)
#points = matrix(c(-39.2832938, 174.0509033), ncol=2, byrow=T)
points = matrix(c(6213008.810261,2600707.709306), ncol=2, byrow=T)
resp = POST("http://elevation.auckland-cer.cloud.edu.au", body = list(points = toJSON(points), proj = "EPSG:27200"), encode = "form")
elevations = fromJSON(content(resp, "text"))
print(elevations)
@neon-ninja
neon-ninja / venice_slr.kml
Last active January 28, 2020 01:10
Venice Sea Level Rise demo
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2" xmlns:kml="http://www.opengis.net/kml/2.2" xmlns:atom="http://www.w3.org/2005/Atom">
<Document>
<name>Venice Sea Level Rise</name>
<open>1</open>
<Style>
<ListStyle>
<listItemType>radioFolder</listItemType>
<bgColor>00ffffff</bgColor>
<maxSnippetLines>2</maxSnippetLines>
@neon-ninja
neon-ninja / P_idx_mat_replacement.py
Created April 10, 2021 02:02
replacing values in an 2D matrix containing irregular arrays, ints to floats
#!/usr/bin/env python3
import numpy as np
from scipy.io import loadmat, savemat
from tqdm.auto import tqdm
p_idx = loadmat("P_idx.mat",simplify_cells=True,mat_dtype=True)["P_idx"] # mat_dtype is necessary as we're replacing ints with floats
print(p_idx.shape)
replace = loadmat("Replacing_values.mat",simplify_cells=True)["network1"]
print(replace)
for pair in tqdm(replace):
FID = pair["FID_1"]
@neon-ninja
neon-ninja / d3_circles.html
Created May 11, 2021 06:31
circle animation
<html>
<head>
<style>
html,
body,
svg {
width: 100%;
height: 100%;
margin: 0;
overflow: hidden;
@neon-ninja
neon-ninja / animated_lines.py
Created May 18, 2021 03:02
Python script to generate a gif animation of random lines
from matplotlib import pyplot as plt
from numpy.random import rand
from matplotlib.collections import LineCollection
from matplotlib import cm
import numpy as np
import imageio
from IPython.display import Image
ims = []
for frame in range(100):