Skip to content

Instantly share code, notes, and snippets.

Instance type

g4dn.xlarge

AMI ID

ami-078a7f1dda72c0775

force_gpy.py

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.

aws ecs register-task-definition input JSON from existing task definition

aws ecs describe-task-definition --task-definition pgbouncer | jq '.taskDefinition | del(.status, .requiresAttributes, .requiresCompatibilities, .compatibilities, .taskDefinitionArn, .revision)'
docker node inspect $(docker node ls -q | xargs) | jq '[.[] | [.Spec.Role, "\(.Description.Hostname) - \(.ID)", .Spec.Labels, if .Description.Engine.Labels.frontend == "true" then { "frontend": true } else null end]] | group_by(.[0])'
curl -s $DOCKER_HOST/tasks | jq '[.[] | select(.DesiredState == "shutdown" and .Status.State == "running")] | sort_by(.NodeID) | .[] | [.NodeID, .ServiceID, .ID, .DesiredState, .Status.State] | @csv' -r
curl -s $DOCKER_HOST/tasks | jq '.[] | select(.NodeID == "jsr6wfrc43641huemibc1ea29") | [.NodeID, .ServiceID, .ID, .DesiredState, .Status.State] | @csv' -r
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
<?xml version="1.0" encoding="UTF-8"?>
<jmeterTestPlan version="1.2" properties="2.9" jmeter="3.0 r1743807">
<hashTree>
<TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="Test Plan" enabled="true">
<stringProp name="TestPlan.comments"></stringProp>
<boolProp name="TestPlan.functional_mode">false</boolProp>
<boolProp name="TestPlan.serialize_threadgroups">false</boolProp>
<elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
<collectionProp name="Arguments.arguments"/>
</elementProp>
@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)

Keybase proof

I hereby claim:

  • I am charly-vega on github.
  • I am charly_vega (https://keybase.io/charly_vega) on keybase.
  • I have a public key ASBG4Pc-8vUnXNf_sPh5GD6wp3O3TK0ujvxS-wyLJwhArQo

To claim this, I am signing this object: