Skip to content

Instantly share code, notes, and snippets.

@zori
zori / ffmpeg_trim_audio.sh
Created March 28, 2019 04:42
Trim audio files without losing quality
# Note the order of arguments matters, otherwise you might get an `Unknown decoder 'copy'`
# start from 5 seconds, trim until 01:19
# The output will have a duration of 01:14 = 74 seconds
ffmpeg -ss 00:05 -to 01:19 -i input.mp3 -acodec copy output.mp3
@zori
zori / display-cv-image-using-matplot.ipynb
Last active September 4, 2018 03:58 — forked from ayang/display-cv-image-using-matplot.ipynb
display opencv image using matplotlib in ipython notebook
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@zori
zori / showarray.py
Last active November 21, 2017 07:24 — forked from kylemcdonald/showarray.py
Minimal code for rendering a numpy array as an image in a Jupyter notebook in memory. Borrowed from the Deep Dream notebook.
# python3
from io import BytesIO
import IPython.display
import numpy as np
import PIL.Image
def showarray(a, fmt='png'):
a = np.uint8(a)
f = BytesIO()
@zori
zori / eval-faster-rcnn.py
Last active June 26, 2017 08:24
Evaluate ChainerCV Faster R-CNN performance on VOC 2007 test
import pprint
import chainer
from chainercv.datasets import voc_detection_label_names
from chainercv.datasets import VOCDetectionDataset
from chainercv.extensions import DetectionVOCEvaluator
from chainercv.links import FasterRCNNVGG16
eval_data = VOCDetectionDataset(split='test', year='2007', use_difficult=True, return_difficult=True)
@zori
zori / gist:f050f64f2f1e092475c5495e6b1dc866
Created February 16, 2017 14:04 — forked from tonymtz/gist:714e73ccb79e21c4fc9c
Uninstall XQuartz.app from OSX Yosemite
launchctl unload /Library/LaunchAgents/org.macosforge.xquartz.startx.plist
sudo launchctl unload /Library/LaunchDaemons/org.macosforge.xquartz.privileged_startx.plist
sudo rm -rf /opt/X11* /Library/Launch*/org.macosforge.xquartz.* /Applications/Utilities/XQuartz.app /etc/*paths.d/*XQuartz
sudo pkgutil --forget org.macosforge.xquartz.pkg
# Log out and log in
@zori
zori / tmux_cheatsheet.markdown
Created February 8, 2017 09:31 — forked from henrik/tmux_cheatsheet.markdown
tmux cheatsheet

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name: