Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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 / 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 / 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 / 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
@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')