Skip to content

Instantly share code, notes, and snippets.

View nbadal's full-sized avatar
🌞

Nick Badal nbadal

🌞
View GitHub Profile
@nbadal
nbadal / tesla-svgs.py
Last active January 28, 2023 14:21
Tesla Part Catalog SVG Downloader (requires "requests": pip install requests)
import json
import os
import sys
import time
import requests
if sys.version_info > (3, 0):
from urllib.parse import unquote
else:
Verifying my Blockstack ID is secured with the address 11Yq3zeN3KXkPwQTKN8oJFsVcZRJjMQuj https://explorer.blockstack.org/address/11Yq3zeN3KXkPwQTKN8oJFsVcZRJjMQuj
@nbadal
nbadal / genimages.py
Created February 25, 2016 02:20
Generates images with random dates
#!/usr/bin/python
from PIL import Image, ImageFont, ImageDraw, ExifTags
import piexif
from datetime import datetime, timedelta
import random
import sys
def random_date(start, end):
delta = end - start
int_delta = (delta.days * 24 * 60 * 60) + delta.seconds
@nbadal
nbadal / ArtistAlphabetizer.java
Created December 16, 2014 08:27
Artist Alphabetizer Comparator
/** Ignores case, and ignores prefix of "The" */
public class ArtistAlphabetizer implements Comparator<String> {
@Override
public int compare(String a, String b) {
int aIdx = a.toLowerCase().startsWith("the ") ? 4 : 0;
int bIdx = b.toLowerCase().startsWith("the ") ? 4 : 0;
return a.substring(aIdx).compareToIgnoreCase(b.substring(bIdx));
}
}

Keybase proof

I hereby claim:

  • I am nbadal on github.
  • I am nbadal (https://keybase.io/nbadal) on keybase.
  • I have a public key whose fingerprint is 115E 856D 3DB4 56DA 934E 1B14 7429 A381 8A69 6165

To claim this, I am signing this object:

1) Drop 2 lowest scores in a specific category, and adjust total/score:
- Will gracefully handle if there's < 1 or 2 assignments
- C3 is original total or score sums, A3 is the category title
- AssignmentCats is the column of each assignments category, AssignmentScores is the column of scores, AssignmentTotals is the column of total possible points per assignment
NOTE: Switch AssignmentScores with AssignmentTotals to get adjusted total instead of score
=C3-IF(COUNTIF(AssignmentCats,A3)>0,SMALL(IF(AssignmentCats=A3,INDEX(AssignmentScores,IF(AssignmentCats=A3,ROW(AssignmentCats)))),1),0)-IF(COUNTIF(AssignmentCats,A3)>1,SMALL(IF(AssignmentCats=A3,INDEX(AssignmentScores,IF(AssignmentCats=A3,ROW(AssignmentCats)))),2),0)
@nbadal
nbadal / PerlinNoise.java
Created May 8, 2013 05:10
Java Perlin Noise class.
import java.util.Random;
public class PerlinNoise {
final static int TABLE_SIZE = 64;
private final static double WEIGHT(double T) {
return ((2.0 * Math.abs(T) - 3.0) * (T) * (T) + 1.0);
}