Skip to content

Instantly share code, notes, and snippets.

View cesarmiquel's full-sized avatar

Cesar Miquel cesarmiquel

View GitHub Profile
@cesarmiquel
cesarmiquel / Toroid-02.js
Created March 29, 2021 04:52
Toroid p5js experiment #2
function setup() {
createCanvas(800, 800, WEBGL);
}
function draw() {
background("#111515");
let scaleFactor = 1;
@cesarmiquel
cesarmiquel / Toroid-01.js
Created March 29, 2021 04:15
Toroid p5js experiment #1
function setup() {
createCanvas(800, 800, WEBGL);
}
function draw() {
background("#111515");
let scaleFactor = 2;
@cesarmiquel
cesarmiquel / bitstamp-scrape.py
Last active February 22, 2021 16:25
Scrape Bitstamp for currency
import requests
import datetime
import os
import time
import json
# -------------------------------------------------------
#
# User Bitstamp API to scrape current data. See:
#
@cesarmiquel
cesarmiquel / init.vim
Created December 21, 2020 21:37
NeoVim configuration: ~/.config/nvim/init.vim
if exists('g:GtkGuiLoaded')
" some code here
call rpcnotify(1, 'Gui', 'Font', 'Monoid Regular 10')
let g:GuiInternalClipboard = 1
endif
" ----------------------------------------------------------------------------------
" Installed plugins. To install/update use: PlugInstall
" ----------------------------------------------------------------------------------
call plug#begin()
@cesarmiquel
cesarmiquel / graphql-drupal-menu-query.graphql
Created August 31, 2020 23:05
GraphQL - Drupal - Menu query
#
# Query 'main' menu
#
query {
mainMenu:menuByName(name:"main") {
links {
label
expanded
url {
path
@cesarmiquel
cesarmiquel / graphql-drupal-node-query.graphql
Last active August 31, 2020 23:03
GraphQL - Drupal - Node query
#
# Query published nodes of type article
#
query {
nodeQuery(
filter:{
conditions:[
{field:"type", value:"article"},
{field:"status", value: "1"}
]
@cesarmiquel
cesarmiquel / labels.ll
Created July 6, 2020 03:23
C64 I/O Map labels for Vice - These are the labels for the region $D000-$DFFF as they appear in "Mapping the Commodore 64" by Sheldon Leemon, ISBN 0-942386-23-X
ATDCY1=$D405
ATDCY2=$D40C
ATDCY3=$D413
BGCOL0=$D021
BGCOL1=$D022
BGCOL2=$D023
BGCOL3=$D024
C2DDRA=$DD02
C2DDRB=$DD03
CI2CRA=$DD0E
@cesarmiquel
cesarmiquel / term-node-count.sql
Last active June 30, 2020 21:39
Count number of nodes with a particular term id for Drupal 8.x
select
ti.tid
, ttfd.name
, count(1) as count
from
taxonomy_index ti join node n on n.nid = ti.nid
, taxonomy_term_data td
, taxonomy_term_field_data ttfd
where
td.tid = ti.tid
@cesarmiquel
cesarmiquel / process-vga-pallette.php
Created April 16, 2020 04:39
VGA 256 Color Palette to RGB
<?php
$im = imagecreatefrompng("vga-palette.png");
$sx = (int) 800 / 16;
$sy = (int) 800 / 16;
$ox = (int) ($sx / 2);
$oy = (int) ($sx / 2);
for($y = 0; $y < 16; $y++) {
for($x = 0; $x < 16; $x++) {
$rgb = imagecolorat($im, $sx*$x + $ox, $sy*$y + $oy);
@cesarmiquel
cesarmiquel / copy-to-s3.sh
Last active April 2, 2020 21:13
Upload a file to an Amazon S3 bucket with this bash script (requires OpenSSL and Curl)
#!/bin/bash
#
# Usage: copy-to-s3.sh /full/path/to/the/file.txt /path/in/amazon/fle.txt
#
# Caveat: the path to the file in AWS needs to be URL Encoded (in case there are spaces, etc)
#
# Minimum tweak from this Gist: https://gist.github.com/chrismdp/6c6b6c825b07f680e710
#
# You don't need Fog in Ruby or some other library to upload to S3 -- shell works perfectly fine