Skip to content

Instantly share code, notes, and snippets.

Avatar

Abe Pazos hamoid

View GitHub Profile
@hamoid
hamoid / theme.txt
Last active Dec 3, 2021
Processing IDE dark theme
View theme.txt
# Processing IDE - dark theme
# Deprecated! See below for a newer version for Processing 3.5.4 by @RandomGuy3015
# File location: processing-3.0a5/lib/theme.txt
# Make a backup of the original theme.txt
# Then replace it with this code
# Code colors can be adjusted in the preferences.txt file
View hackerNewsPostStats.js
// Run in the js console while viewing a submission in HackerNews
// for example while visiting https://news.ycombinator.com/item?id=27799859
console.log('Users with more than 1 answer:')
var counts = {};
var arr = Object.values(document.getElementsByClassName('hnuser')).map(h => h.innerHTML);
arr.forEach(function (x) {
counts[x] = (counts[x] || 0) + 1;
});
var sorted = Object.entries(counts);
@hamoid
hamoid / multiple_frame_rates.pde
Created May 3, 2013
In Processing, frameRate() sets the global frame rate. It does not allow to set independent frame rates for different objects. To achieve that, you can avoid drawing every object on every frame, effectively reducing the frame rate for some objects. You can learn more about the modulo operation (%), if statements and other concepts used in this p…
View multiple_frame_rates.pde
void setup() {
// Global frame rate is 30 fps
// 1 second = 30 frames
frameRate(30);
}
void draw() {
// Change the background once every 30 frames
// 30 frames is 1 second, so that means
// change the background at 1 fps
if(frameCount % 30 == 0) {
@hamoid
hamoid / workshop.md
Last active Oct 27, 2019
Links for In the Mood for Shaders workshop
@hamoid
hamoid / darken-page-bookmarklet.js
Created Feb 6, 2016
Bookmarklet that makes pages dark, by applying white background to everything, then applying filter invert and grayscale
View darken-page-bookmarklet.js
javascript:(function()%20{%20var%20tag%20=%20document.createElement('style');%20tag.type%20=%20'text/css';%20document.getElementsByTagName('head')[0].appendChild(tag);%20tag[%20(typeof%20document.body.style.WebkitAppearance=='string')%20?%20'innerText'%20:%20'innerHTML']%20=%20'*%20{%20background-color:%20white%20!important;%20color:%20#444%20!important;%20%20}%20html%20{%20filter:%20invert(100%)%20grayscale(100%);%20}';%20})();
@hamoid
hamoid / temp.csv
Created Feb 26, 2018
Temperature deviation 1880 - 2016
View temp.csv
year temp
1880 -0.20
1881 -0.11
1882 -0.09
1883 -0.20
1884 -0.27
1885 -0.30
1886 -0.29
1887 -0.32
1888 -0.20
@hamoid
hamoid / download.js
Last active Feb 18, 2018
Download Berlin air pollution data from berlin.de
View download.js
// launch with: node download.js
var http = require('http');
var fs = require('fs');
var start = new Date();
var end = new Date();
start.setDate(end.getDate() - 365);
var download = function() {
@hamoid
hamoid / generativeSpreadsheet.bas
Created Oct 23, 2017
Generative spreadsheet for LibreOffice
View generativeSpreadsheet.bas
REM ***** BASIC *****
Sub Main
Dim Doc As Object
Dim Sheet As Object
Dim Cell As Object
Dim s As String
Doc = ThisComponent
Sheet = Doc.Sheets(0)
View lemonade-dream.scd
(
SynthDef(\lemonade_dream, {
arg gate = 1,
freq = 440,
f2 = 500,
spreadf = 222,
sustain = 1,
amp = 0.1,
mix = 0.1,
release = 0.1;
@hamoid
hamoid / processingOnTumblr.html
Last active Jul 4, 2016
Code that allows you to post and run Processing sketches on Tumblr
View processingOnTumblr.html
<script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
<script>
// processing.js loader
// by Abe Pazos - 23.01.2014 - http://funprogramming.org
// Updated - 04.07.2016
// 1. Install this script:
// A. Your Tumblr html template should include jquery. If missing, paste
// the first line above to load jquery. If jQuery is already available