Skip to content

Instantly share code, notes, and snippets.

@neuman
neuman / DiscoMasher.py
Last active June 8, 2022 21:53
Disco Diffusion Prompt Generator.py
import random
hash_tag_string = ""
description_text_string = ""
# return bool(random.getrandbits(1))
# [subject]}, [prepositional details]}, [setting]}, [meta modifiers and artist]
# a beautiful symmetrical painting of a lighthouse at sunset, overlooking a calm ocean, as seen from below, by thomas kinkade
#"FORMULA": ["MEDIA_TYPES","THINGS","PLACES","VIEWPOINTS","ARTISTS","MODIFIERS"],
10;https://trello.com/b/ejFbDwWP/fridge-door
10;http://10.0.0.181:2202/ubooquity/comics/25819/?random=true
10;https://trello.com/b/omLiMCaX/house
10;http://10.0.0.181:32400/web/index.html
10;https://sharptools.io/dashboard/view/XeC32e8uq6XwNMgzW5wD
10;https://trello.com/b/raQF7oGp/recipes
20;https://www.ecobee.com/consumerportal/index.html#/devices/thermostats/311036220143/homeiq/diagnostics/system
10;https://photos.google.com/share/AF1QipMNFBoE8PfxvoOyg3CId_Vby4Ln_r6OGk8jTlPqGb6IEe4AgrhQhQLhJETKNr5sbA?key=OHJTcUlSVXE2UEYxWm5NeU95aFZlTml6WGN3bndn
10;http://10.0.0.181:3003/d/A4ESkhbMz/temp?orgId=1
10;http://10.0.0.181:3003/d/oXkEf1xGz/iot?orgId=1
@neuman
neuman / pdf_to_cbz.sh
Created November 21, 2018 09:42
Convert PDF to CBZ in Bash
for i in *.pdf
do
if test -f "$i"
then
echo "Converting $i to ${i%.*}.cbz"
convert -density 150 "$i" -quality 90 output.png
zip -R "${i%.*}".cbz '*.png'
rm *.png
fi
class TweetScraper(object):
def scrape(self, query, when=None, tokens=None):
output = []
if when == None:
when = (datetime.datetime.now() - datetime.timedelta(hours=24)).strftime('%Y-%m-%d')
for tweet in self.get_tweets_since(query, when, tokens):
blob = TextBlob(tweet['text'])
new_tweet = cm.Tweet(text=tweet['text'], url=tweet['id'], profile_image_url=tweet['user']['profile_image_url'], screen_name=tweet['user']['screen_name'], favourites_count=tweet['favorite_count'], retweet_count=tweet['retweet_count'], followers_count=tweet['user']['followers_count'], polarity=blob.polarity, subjectivity=blob.subjectivity)
o.centerOriginToTopLeft = (x, y, w, h) =>{
return new THREE.Vector2((w/2)-x, (h/2)-y);
};
o.latLonToVector3 = (lat, lng, radius) => {
// convert latitude / longitude to angles between 0 and 2*phi
var phi = (90 - lat) * Math.PI / 180;
var theta = (180 - lng) * Math.PI / 180;
// Calculate the xyz coordinate from the angles
@neuman
neuman / DDD.cs
Created July 18, 2017 05:06
3d library for unity
using System;
using UnityEngine;
using System.Collections.Generic;
public static class DDD
{
/*
MILKCRATE.ddd.latLongToVector3 = function(lat, lng, radius, h)
{
// convert latitude / longitude to angles between 0 and 2*phi
from __future__ import division, unicode_literals
import math
from textblob import TextBlob as tb
from goose import Goose
def tf(word, blob):
return blob.words.count(word) / len(blob.words)
def n_containing(word, bloblist):
return sum(1 for blob in bloblist if word in blob)
@neuman
neuman / HoverBob.cs
Created October 9, 2015 06:29
Unity Hovering Animation Behavior
using UnityEngine;
using System.Collections;
using System;
public class HoverBob : MonoBehaviour {
float originalY;
public float floatSpeed = 1;
public float floatStrength = 1;
@neuman
neuman / Find_Keywords.py
Created September 14, 2015 18:00
Find Keywords Across Documents
from __future__ import division, unicode_literals
import math
from textblob import TextBlob as tb
from goose import Goose
def tf(word, blob):
return blob.words.count(word) / len(blob.words)
def n_containing(word, bloblist):
return sum(1 for blob in bloblist if word in blob)
class EmbeddedMixin(object):
def get_embedded(self, hierarchy, key, value, depth=0, indexes=False):
index = 0
domain = hierarchy.pop(0)
if len(hierarchy) == 0:
for embedded in self[domain]:
if embedded[key] == value:
if indexes == True:
return [index]