Skip to content

Instantly share code, notes, and snippets.

View ptgamr's full-sized avatar

Anh Trinh ptgamr

View GitHub Profile
@ptgamr
ptgamr / ffmpegExplained.sh
Created July 5, 2022 08:34
FFMPEG Explained
ffmpeg -re \
# -re (input)
# Read input at native frame rate. Mainly used to simulate a grab device, or live input stream (e.g. when reading from a file). Should not be used with actual grab devices or live input streams (where it can cause packet loss). By default ffmpeg attempts to read the input(s) as fast as possible. This option will slow down the reading of the input(s) to the native frame rate of the input(s). It is useful for real-time output (e.g. live streaming).
# (!) Turns out this will interrupt the stream by the audio input, making the output stream fps looks extremely low
-pix_fmt uyuv442 \
-framerate 30 \
-f avfoundation \
# Pixel format & Framerate for FFMPEG-device: https://www.ffmpeg.org/ffmpeg-devices.html#avfoundation
-i "0" \
# Use input "0" from avfoundation
@ptgamr
ptgamr / canvasArrowhead.js
Created January 19, 2022 20:48 — forked from jwir3/canvasArrowhead.js
Code to create an arrowhead on an html5 canvas
/**
* Draw an arrowhead on a line on an HTML5 canvas.
*
* Based almost entirely off of http://stackoverflow.com/a/36805543/281460 with some modifications
* for readability and ease of use.
*
* @param context The drawing context on which to put the arrowhead.
* @param from A point, specified as an object with 'x' and 'y' properties, where the arrow starts
* (not the arrowhead, the arrow itself).
* @param to A point, specified as an object with 'x' and 'y' properties, where the arrow ends
@ptgamr
ptgamr / app.transitions.js
Created December 15, 2020 01:58 — forked from jacobq/app.transitions.js
Modal Dialog Test
// Problem happens regardless of duration, but unless using
// the `.velocity-animating` CSS hack it is easier to see with longer durations.
const options = {duration: 1000, easing: 'easeInOutQuad'};
export default function(){
this.transition(
// this works
//this.use('fade')
// this has a glitch; can see second copy/ghost of modal in top left when closing
@ptgamr
ptgamr / controllers.application\.js
Last active September 29, 2020 22:57
Ember playground
import Controller from '@ember/controller';
import EmberObject, { computed, action } from '@ember/object';
let Person = EmberObject.extend({
// these will be supplied by `create`
firstName: null,
lastName: null,
address: {
road: 'Northland',
@ptgamr
ptgamr / comments-box-initial-template.hbs
Last active August 28, 2019 04:14
Ember training gist
<div class="ui comments">
<h3 class="ui dividing header">Comments</h3>
<div class="comment">
<a class="avatar">
<img src="https://api.adorable.io/avatars/100/[email protected]">
</a>
<div class="content">
<a class="author">Matt</a>
<div class="metadata">
<span class="date">Today at 5:42PM</span>
3290  sudo sh ~/Downloads/cuda_10.0.130_410.48_linux.run              
3291  tail -f /var/log/nvidia-installer.log                              
3292  lsmod | grep nouveau                       
3293  tail -f /var/log/nvidia-installer.log                                              
3294  nvidia-detector            
3295  lsmod | grep nouveau                                       
3296  sudo sh ~/Downloads/cuda_10.0.130_410.48_linux.run


@ptgamr
ptgamr / Reddit thread.md
Created December 7, 2018 22:20
Slow Vim on Mac

https://www.reddit.com/r/vim/comments/7fqpny/slow_vim_scrolling_and_cursor_moving_in_iterm_and/

i guys, I'm desperate :c Just bought my new MacBook pro 2017 and was very happy with it for a while until I decided to configure my vim. On Linux vim works just fine, scrolling is always ok even with a much faster cursor speed than I have now on mac. But lately I spent a WHOLE day trying to figure out what's wrong with scrolling speed on mac. It drives me insane. Both terminal and iterm are extremely slow at rendering and even moving the cursor around without scrolling at all is laggy!

I think I tried almost all the possible suggestions including

setting ttyfast and lazyredraw

speeding up my key repeat to 1(scroll is faster but even more laggy)
@ptgamr
ptgamr / clean-up-boot-partition-ubuntu.md
Created September 18, 2018 10:44 — forked from ipbastola/clean-up-boot-partition-ubuntu.md
Safest way to clean up boot partition - Ubuntu 14.04LTS-x64

Safest way to clean up boot partition - Ubuntu 14.04LTS-x64

Reference

Case I: if /boot is not 100% full and apt is working

1. Check the current kernel version

$ uname -r 
fetch('https://cdn.jsdelivr.net/npm/[email protected]/lodash.min.js')
.then(response => response.text())
.then(text => eval(text))
@ptgamr
ptgamr / concat.sh
Last active September 3, 2018 08:38
concat audio add delay (install http://macappstore.org/sox/)
#! /bin/bash
sox -n -r 22050 -c 1 /tmp/silence.wav trim 0.0 15
sox /tmp/silence.wav -C 48.01 /tmp/silence.mp3
sox $(for f in `ls *.mp3 | sort -V`; do echo -n "$f /tmp/silence.mp3 "; done) output.mp3