Skip to content

Instantly share code, notes, and snippets.

@gifguide2code
gifguide2code / JSON2CSV-Google_Location_History.py
Last active December 30, 2022 16:45
Converts a Google Location JSON file into a CSV with Timestamp, Latitude, and Longitude.
import re
import json
import csv
JSON_data="C:/Users/JSON FILE PATH.txt"
CSV_file="C:/Users/CSV FILE PATH.csv"
with open(JSON_data) as f:
data = json.load(f)
csv_f=open(CSV_file, 'w')
@gifguide2code
gifguide2code / csvParser.py
Created January 5, 2019 15:42
A Python script that will return the number of rows and columns in a spreadsheet, list out the headers, and prompt the user for two columns to extract into a new csv file.
import csv
CSVfile = 'C:/Users/The CSV to Parse'
condCSVpath = 'C:/Users/The New CSV to Save'
#the .reader function returns a parsed list of rows
#Function counts number of rows
def HowManyRows(fp):
f = open(fp, encoding='utf8')
csv_f = csv.reader(f)
@gifguide2code
gifguide2code / Colorify.gs
Created August 18, 2018 16:54
A script to randomize all the character colors in a Google Doc. Use with caution.
function Multicolor() {
var doc = DocumentApp.getActiveDocument();
var body = doc.getBody();
//This Loops Through All Paragraphs
for(var i=0; i<body.getNumChildren(); i++) {
var par = body.getChild(i);
//This Loops Through Paragraph Children
@gifguide2code
gifguide2code / Fade-In-Text.gs
Created August 13, 2018 00:07
A script for Google Docs, gently turning white text to black in the first paragraph of a document.
function myFunction() {
var doc = DocumentApp.getActiveDocument();
var body = doc.getBody();
var paragraph = body.getChild(0);
var txt = paragraph.asParagraph().getChild(0); //This returns the text in the first paragraph.
var len = txt.asText().getText().length; //This returns the number of characters in the first paragraph.
Logger.log(len);
var red = 250;
var green = 250;
@gifguide2code
gifguide2code / CraigslistScraper.py
Last active August 11, 2018 16:17
A Python script to scrape the Craigslist apartment listings into an Excel spreadsheet.
import requests
import bs4
import openpyxl
#Functions to remove empty spaces and make a dictionary of listing names/URLs
def strip(txt):
ret=""
for l in txt.split("\n"):
if l.strip()!='':
ret += l + "\n"
@gifguide2code
gifguide2code / Firefly.py
Created July 22, 2018 14:35
The code for an add-on that generates 100 spheres at random locations in a 20 x 20 space at the center of a Blender scene.
bl_info = {
"name": "Fireflies",
"author": "GifGuide2Code",
"version": (1,0,0),
"category": "Object",
}
import bpy
import random
@gifguide2code
gifguide2code / ImageDecoder
Created July 9, 2018 01:22
A Processing sketch to pull messages out of pngs encoded with the ImageEncoder at https://gist.github.com/gifguide2code/382e99ee16e9defdaa9185979c3242ae
IntList numbers;
void setup () {
numbers = new IntList();
size(400, 317);
PImage Original = loadImage("Starry Night.jpg");
PImage Encoded = loadImage("Encoded.png");
Original.loadPixels();
Encoded.loadPixels();
for (int x=0; x<width;x++) {
for (int y=0;y<height;y++) {
@gifguide2code
gifguide2code / ImageEncoder
Created July 9, 2018 01:20
A Processing sketch to hide messages in images. It assigns letters to numbers which are then used to change the red values in a .png copy of the original.
IntList numbers;
void setup () {
numbers = new IntList();
String abc = ". abcdefghijklmnopqrstuvwxyz";
String message = "there is a place where the sidewalk ends and before the street begins and there the grass grows soft and white and there the sun burns crimson bright and there the moon bird rests from his flight to cool in the peppermint wind";
int n = 0;
for (int i=0; i<message.length();i++) {
String letter = str(message.charAt(i));
numbers.append(abc.indexOf(letter));
@gifguide2code
gifguide2code / imageLoad.py
Created July 1, 2018 22:24
This Blender function will go through a folder, pull all the jpg's inside, and map them to planes in Blender along the Z axis.
import bpy
import os
def imageLoad(imgpath):
z=0
files = os.listdir(imgpath)
#Get the names of the files in the provided folder
for x in range(len(files)):
imagename = files[x][0:20]
if files[x].endswith('.jpg'):
@gifguide2code
gifguide2code / Confetti.py
Created June 30, 2018 16:36
A Python function to create confetti in Blender, more specifically it'll create 100 small planes, assign those a new texture, and randomize their location. The confetti function takes three parameters--the first is the name of the material to be assigned, the next three are the RGB values for that material. The code below will generate yellow, g…
import bpy
import random
def confetti(MatCol,r,g,b):
bpy.ops.mesh.primitive_plane_add()
bpy.ops.transform.resize(value=(.1,.1,.1))
#Resize to fit the scene
bpy.data.objects['Plane'].name = MatCol
#Rename the planes as the 1st paramater above
mat_name = MatCol