Skip to content

Instantly share code, notes, and snippets.

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