Skip to content

Instantly share code, notes, and snippets.

View CyanLetter's full-sized avatar

Dakota Ling CyanLetter

View GitHub Profile
@CyanLetter
CyanLetter / vnc-setup.md
Created November 22, 2017 06:11
Steps for getting vnc remote desktop working on Ubuntu 16

VNC Running

Ubuntu should already have a vnc server running on port 5900. The last 0 in this is the display number, and 0 refers to the default desktop. Additional desktops can be generated, but we shouldn't have to do that now.

You can / may need to install a vnc server with sudo apt-get install vnc4server

Enable Access

  • Search for 'Desktop Sharing' and open the preference pane that comes up.
  • Check 'Allow Others to Use Your Desktop' and 'Allow Others to Control Your Desktop' to enable access
@CyanLetter
CyanLetter / deepdreamsetup.md
Last active January 29, 2020 18:38
Deep Dream Setup Linux
@CyanLetter
CyanLetter / passgen.sh
Created October 17, 2017 22:20
Random 16 character string generator for passwords on mac
#!/bin/bash
date +%s | shasum -a 256 | base64 | head -c 16 ; echo
@CyanLetter
CyanLetter / BatchChangeTextureSettings.md
Created September 26, 2017 19:52
Change Unity texture import settings for a directory

cd into texture directory and run the command below. It will set the textures to be non-writeable, set the max size to 2048, and set very aggressive compression settings

for i in *.png.meta; do sed -i '' 's/isReadable: 1/isReadable: 0/g; s/maxTextureSize: 4096/maxTextureSize: 2048/g; s/textureCompression: 1/textureCompression: 2/g; s/compressionQuality: 50/compressionQuality: 100/g; s/crunchedCompression: 0/crunchedCompression: 1/g;' $i; done

Start with an mp4 video. Animations with large fiels of solid color and hard edges on their borders work best.

Currently 'threads' is set to 6, reduce if you have fewer cores available

Convert video to png sequence getting only the luma channel

ffmpeg -i source_video.mp4 -filter_complex "extractplanes=y" -threads 6 -vcodec png diffs_%05d.png

Get differences between frames, discarding other information

VS Code Setup for Unity

Some references to get Visual Studio code set up and working properly on a Mac with Unity 5.5+. Remember that the 3rd party plugin is no longer necessary.

Make sure to follow the .NET Core installation guide for Mac. Don't ignore the openSSL portion.

Install the Mono Project package.

Set your preferences un Unity to open scripts with VSCode.

ffmpeg

Reccomended ffmpeg install settings

brew install ffmpeg --with-libvpx --with-libvorbis --with-fdk-aac --with-theora

Or if you like LOTS of options:

brew install ffmpeg --with-fdk-aac --with-ffplay --with-freetype --with-libass --with-libquvi --with-libvorbis --with-libvpx --with-opus --with-x265 --with-theora --use-gcc
#!/bin/bash
# Originally built to make a gif out of captured frames from a photobooth app
# Pass in destination file name - timestamps
output="$1"
# File paths are relative to your document root
# Framerate based on capture speed
# This site was insturmental in making this work: http://blog.pkh.me/p/21-high-quality-gif-with-ffmpeg.html
/usr/local/bin/ffmpeg -y -framerate 15 -i assets/saved/temp/%*.png -vf fps=30,scale=-1:-1:flags=lanczos,palettegen assets/saved/palette.png && /usr/local/bin/ffmpeg -y -framerate 15 -i assets/saved/temp/%*.png -i assets/saved/palette.png -filter_complex "fps=30,scale=640:360:flags=lanczos[x];[x][1:v]paletteuse" "$output" 2>&1
@CyanLetter
CyanLetter / deeply_dreaming_potter.txt
Last active March 12, 2016 02:34
Google deep dream settings and code for producing video from a png sequence, using openCV optical flow and frame blending
import cv2 #Move this line to the beginning of the script, next to the caffe import
#Deep Dream Settings used: iter_n=30, octave_n=5, octave_scale=1.4, end='inception_5a/pool_proj'
def morphPicture(filename1,filename2,blend):
img1 = PIL.Image.open(filename1)
img2 = PIL.Image.open(filename2)
return PIL.Image.blend(img1, img2, blend)
#Make sure to replace all image paths