Skip to content

Instantly share code, notes, and snippets.

View spirosrap's full-sized avatar
🦾
"Science has taught me that everything is more complicated than we first assume"

Spiros Raptis spirosrap

🦾
"Science has taught me that everything is more complicated than we first assume"
View GitHub Profile
@spirosrap
spirosrap / macos-screen-recording-to-gif.md
Last active November 29, 2020 04:12
Create a screen recording on a mac with built in tools and convert to gif with ffmpeg

Convert recorded video from Mac (command+shift+5) to a gif with ffmpeg

ffmpeg -i test.mov -vf scale=800:-1 -pix_fmt rgb24 -r 25 -f gif - | gifsicle --optimize=3 --delay=3 > out2.gif

https://gist.github.com/dergachev/4627207

Parameters to keep in mind:

  • scale=800:-1 Keeps aspect ratio
  • -r 25 fps
@spirosrap
spirosrap / gist:d2561df961da3294d28d83d444e17065
Last active November 29, 2020 04:08
Vagrant VM with Virtual Box basic usage

Create a new VM

vagrant init ubuntu/focal64

add these to Vagrantfile to specify host name and name:

Vagrant.configure("2") do |config|
if __name__ == '__main__':
source = '''if __name__ == '__main__':
source = {1}{0}{1}
print(source.format(source, "{2}", r"{2}", r"{3}"))'''
print(source.format(source, "\'\'\'", r"\'\'\'", r"\\\\'\\\\'\\\\'"))
q=chr(34);s="q=chr(34);s={};print(s.format(q+s+q))";print(s.format(q+s+q))
t='';s='t=input() or t; print(f"t={repr(t)};s={repr(s)}; exec(s)#{t}")';exec(s)
s='s=%r;print(s%%s)';print(s%s)
c = []
c.append('c = []')
c.append('f = lambda k: "c.append(" + repr(k) + ")"')
c.append('print(c[0])')
c.append('print(f(c[0]))')
c.append('for line in c[1:]:')
c.append(' print(f(line))')
c.append('for line in c[1:]:')
c.append(' print(line)')
f = lambda k: "c.append(" + repr(k) + ")"
@spirosrap
spirosrap / gist:4c96df967aeca03dbf1e8341a714d68e
Last active July 26, 2017 22:09
Generate VGG16 model for CoreML
# Modified from https://gist.github.com/baraldilorenzo/07d7802847aaad0a35d3#file-vgg-16_keras-py
from keras.models import Sequential
from keras.layers.core import Flatten, Dense, Dropout
from keras.layers.convolutional import Convolution2D, MaxPooling2D, ZeroPadding2D
from keras.optimizers import SGD
import cv2, numpy as np
from keras import backend as K
import csv
import coremltools
from keras import models

Keybase proof

I hereby claim:

  • I am spirosrap on github.
  • I am spirosrap (https://keybase.io/spirosrap) on keybase.
  • I have a public key whose fingerprint is 00CA 6053 B265 3DFC 5B56 F8F4 19D9 8FAB 6754 8DC6

To claim this, I am signing this object: