Skip to content

Instantly share code, notes, and snippets.

View hamoid's full-sized avatar
🎨

Abe Pazos hamoid

🎨
View GitHub Profile
@hamoid
hamoid / justTheDocsToPDF.bash
Last active January 24, 2024 13:14
Downloads a just-the-docs website and converts it into a PDF file for offline reading
#!/bin/bash
mkdir -p /tmp/manual
cd /tmp/manual
# curl downloads the index page of the website
# grep extracts the <nav> ... </nav> section
# sed(1) injects a line break in front of every URL and adds the full domain
# sed(2) deletes from each line the " character and everything that follows, leaving the clean URL
# tail deletes the first line, which contains a lonely <nav> tag
@hamoid
hamoid / curveWithVaryingColor.kt
Created March 25, 2023 22:07
OPENRNDR experimentation session with Alessandro and aBe, day 4, episode 5
// By Alessandro and aBe
// Saturday March 25th, 2023
// https://tubedu.org/c/in_conversations_collections/videos
import org.openrndr.application
import org.openrndr.color.ColorRGBa
import org.openrndr.color.rgb
import org.openrndr.draw.*
import org.openrndr.extra.color.presets.BLANCHED_ALMOND
import org.openrndr.extra.noise.Random
@hamoid
hamoid / theme.txt
Last active March 3, 2023 03:11
Processing 3.5.4 IDE dark theme. See thread for 4.0 version (haven't tested it, 4.0b4 crashes for me).
# Processing 3.5.4 IDE - dark theme
# Updated version by @RandomGuy3015
# File location: processing-3.5.4/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
@hamoid
hamoid / multiple_frame_rates.pde
Created May 3, 2013 12:36
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…
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 / FixGradleDependencySources.kt
Created August 29, 2022 16:53
IntelliJ plugin code to add Gradle dependency sources for snapshot libraries. See https://youtrack.jetbrains.com/issue/IDEA-227215/
package com.hamoid.openrndrThumbnails.action
import com.hamoid.openrndrThumbnails.form.SettingsDialog
import com.intellij.icons.AllIcons
import com.intellij.openapi.actionSystem.AnAction
import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.application.WriteAction
import com.intellij.openapi.diagnostic.logger
import com.intellij.openapi.roots.OrderRootType
import com.intellij.openapi.roots.libraries.LibraryTablesRegistrar
@hamoid
hamoid / intellijIdeaExternalToolReplace.kts
Created April 9, 2022 16:03
An example Kotlin script to process source code inside IntelliJ Idea
import java.io.File
// Process your selection inside IntelliJ Idea using a Kotlin script.
//
// 1. Install https://plugins.jetbrains.com/plugin/15539-external-tools-text-replace
// 2. Settings > Tools > External Tools > Create a new tool
// Set these values according to your system:
//
// Name: ?
// Description: ?
// 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 / workshop.md
Last active October 27, 2019 11:01
Links for In the Mood for Shaders workshop
@hamoid
hamoid / darken-page-bookmarklet.js
Created February 6, 2016 10:32
Bookmarklet that makes pages dark, by applying white background to everything, then applying filter invert and grayscale
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 February 26, 2018 13:34
Temperature deviation 1880 - 2016
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