Skip to content

Instantly share code, notes, and snippets.

This demo builds on previous gists in this series to render an audio-modulated WebGL animation, and output a 48 FPS, 1080p, HD video utilizing:

  • HTML5's Web Audio API for analysing an audio file.
  • HTML5's Web Worker API for offloading communications between the web page and the server to separate thread.
  • Socket.io for sending messages (including image and audio files) between client and server.
  • Node.js for the server process for storing generated images and uploaded audio and creating the final video.
  • FFMpeg for the actual video creation.
  • Fluent-ffmpeg for making the configuration and execution of FFMpeg commands easy peasy.
  • @ffmpeg-installer/ffmpeg for installing the correct version of FFMpeg for the hardware this demo runs on.
  • mkdirp for creating the folder path for each client's data, including any missing nodes in the path.
sudo yum -y install freetype freetype-devel libpng-devel
sudo yum -y install mesa-libGLU-devel
sudo yum -y install libX11-devel mesa-libGL-devel perl-Time-HiRes
sudo yum -y install libXtst libXrender
# Insert any url for Linux 64 bit blender
# https://builder.blender.org/download/
wget 'https://builder.blender.org/download/blender-2.78-81d7ff84769-linux-glibc219-x86_64.tar.bz2'
tar -jxvf blender*.tar.bz2
sudo yum update -y
# load the latest kernel version, really dont skip this
sudo reboot
# http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/accelerated-computing-instances.html#install-nvidia-driver
sudo yum install -y gcc kernel-devel-`uname -r`
wget http://us.download.nvidia.com/XFree86/Linux-x86_64/375.66/NVIDIA-Linux-x86_64-375.66.run
sudo /bin/bash ./NVIDIA-Linux-x86_64-375.66.run --no-drm
@charly-vega
charly-vega / gpg2qrcodes.sh
Created May 20, 2018 01:51 — forked from joostrijneveld/gpg2qrcodes.sh
Producing printable QR codes for persistent storage of GPG private keys
# Heavily depends on:
# libqrencode (fukuchi.org/works/qrencode/)
# paperkey (jabberwocky.com/software/paperkey/)
# zbar (zbar.sourceforge.net)
# Producing the QR codes:
# Split over 4 codes to ensure the data per image is not too large.
gpg --export-secret-key KEYIDGOESHERE | paperkey --output-type raw | base64 > temp
split temp -n 4 IMG
for f in IMG*; do cat $f | qrencode -o $f.png; done
import bpy
# https://blender.stackexchange.com/questions/5281/blender-sets-compute-device-cuda-but-doesnt-use-it-for-actual-render-on-ec2
bpy.context.user_preferences.addons['cycles'].preferences.compute_device_type = 'CUDA'
bpy.context.user_preferences.addons['cycles'].preferences.devices[0].use = True
bpy.context.scene.cycles.device = 'GPU'
bpy.data.scenes["Scene"].render.filepath = "/tmp/output.png"
bpy.ops.render.render(write_still=True)
@charly-vega
charly-vega / README.md
Created April 8, 2018 17:49 — forked from bsergean/README.md
three.js + headless.gl rendering with texturing

Getting the code

git clone https://gist.github.com/08be90a2f21205062ccc.git

Executing the code

$ npm install # maybe npm start will take care of it but just in case
$ npm start && open out.png

> offscreen-sample@1.0.0 start /Users/bsergean/src/offscreen_sample

@charly-vega
charly-vega / gist:719b0e8f97a4551399c0ba18e3c05ea2
Created February 9, 2018 17:09 — forked from mtigas/gist:952344
Mini tutorial for configuring client-side SSL certificates.

Client-side SSL

For excessively paranoid client authentication.

Using self-signed certificate.

Create a Certificate Authority root (which represents this server)

Organization & Common Name: Some human identifier for this server CA.

openssl genrsa -des3 -out ca.key 4096
openssl req -new -x509 -days 365 -key ca.key -out ca.crt
@charly-vega
charly-vega / postgres_queries_and_commands.sql
Created December 4, 2017 00:54 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(query_start, clock_timestamp()), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(query_start, clock_timestamp()), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@charly-vega
charly-vega / gpg-import-and-export-instructions.md
Created November 2, 2017 17:21 — forked from chrisroos/gpg-import-and-export-instructions.md
Instructions for exporting/importing (backup/restore) GPG keys

Every so often I have to restore my gpg keys and I'm never sure how best to do it. So, I've spent some time playing around with the various ways to export/import (backup/restore) keys.

Method 1

Backup the public and secret keyrings and trust database

cp ~/.gnupg/pubring.gpg /path/to/backups/
cp ~/.gnupg/secring.gpg /path/to/backups/
cp ~/.gnupg/trustdb.gpg /path/to/backups/

or, instead of backing up trustdb...

@charly-vega
charly-vega / clean-docker-for-mac.sh
Created July 3, 2017 12:07 — forked from MrTrustor/clean-docker-for-mac.sh
This script cleans the Docker.qcow2 file that takes a lot of disk space with Docker For Mac. You can specify some Docker images that you would like to keep.
#!/bin/bash
# Copyright 2017 Théo Chamley
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in the Software
# without restriction, including without limitation the rights to use, copy, modify, merge,
# publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
# to whom the Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all copies or