Skip to content

Instantly share code, notes, and snippets.

View xingfanxia's full-sized avatar
🎯
Focusing

AX xingfanxia

🎯
Focusing
View GitHub Profile
➜ for region in `aws ec2 describe-regions --output text | cut -f3`
do
echo -e "\nListing Instances in region:'$region'..."
aws ec2 describe-instances --region $region
done > payload.json
package main
import (
"fmt"
"io"
"os"
)
var path = "/Users/novalagung/Documents/temp/test.txt"
@xingfanxia
xingfanxia / ffmpeg-minimalist-build-nvenc-static.md
Created March 22, 2018 05:26
Static FFmpeg build on Ubuntu 16.04 with Nvidia NVENC enabled.

Minimalist static FFmpeg build on Ubuntu 16.04 with Nvidia NVENC enabled.

Original guide with a standard build is here.

With this guide, I'm adding more instructions to enable support for NVIDIA CUVID and NVIDIA NPP for enhanced encode and decode performance.

First, prepare for the build and create the work space directory:

cd ~/

@xingfanxia
xingfanxia / ffmpeg-minimalist-build-nvenc-static.md
Created March 22, 2018 05:26
Static FFmpeg build on Ubuntu 16.04 with Nvidia NVENC enabled.

Minimalist static FFmpeg build on Ubuntu 16.04 with Nvidia NVENC enabled.

Original guide with a standard build is here.

With this guide, I'm adding more instructions to enable support for NVIDIA CUVID and NVIDIA NPP for enhanced encode and decode performance.

First, prepare for the build and create the work space directory:

cd ~/

@xingfanxia
xingfanxia / ffmpeg-hevc-encode-nvenc.md
Created March 22, 2018 03:19
This gist shows you how to encode specifically to HEVC with ffmpeg's NVENC on supported hardware, with an optional CUVID-based hardware-accelerated decoder.

Encoding high-quality HEVC content with FFmpeg - based NVENC encoder on supported hardware:

If you've built ffmpeg as instructed here on Linux and the ffmpeg binary is in your path, you can do fast HEVC encodes as shown below, using NVIDIA's NPP's libraries to vastly speed up the process.

Now, to do a simple NVENC encode in 1080p, (that will even work for Maxwell Gen 2 (GM200x) series), start with:

ffmpeg  -i <inputfile>  \
-filter:v scale_npp=w=1920:h=1080:format=nv12:interp_algo=lanczos \

-c:v hevc_nvenc -profile main -preset slow -rc vbr_hq \

@xingfanxia
xingfanxia / ffmpeg-hevc-encode-nvenc.md
Created March 22, 2018 03:19
This gist shows you how to encode specifically to HEVC with ffmpeg's NVENC on supported hardware, with an optional CUVID-based hardware-accelerated decoder.

Encoding high-quality HEVC content with FFmpeg - based NVENC encoder on supported hardware:

If you've built ffmpeg as instructed here on Linux and the ffmpeg binary is in your path, you can do fast HEVC encodes as shown below, using NVIDIA's NPP's libraries to vastly speed up the process.

Now, to do a simple NVENC encode in 1080p, (that will even work for Maxwell Gen 2 (GM200x) series), start with:

ffmpeg  -i <inputfile>  \
-filter:v scale_npp=w=1920:h=1080:format=nv12:interp_algo=lanczos \

-c:v hevc_nvenc -profile main -preset slow -rc vbr_hq \

@xingfanxia
xingfanxia / index.html
Created February 23, 2018 17:21
d3 bar
<!DOCTYPE html>
<meta charset="utf-8">
<style> /* set the CSS */
.bar { fill: steelblue; }
</style>
<body>
<!-- load the d3.js library -->
@xingfanxia
xingfanxia / a.py
Created January 23, 2018 23:28
make matrix
def make_matrix(m, n):
# a = [[0,""]] * m
a = []
for i in range(n):
a.append([[0, ""] for i in range(m)])
return a
@xingfanxia
xingfanxia / crawl.py
Created November 17, 2017 10:00
art history final image crawler
import sys, base64, wget, os, signal
lines = sys.stdin.read().split('\n')
class TimeoutException(Exception): # Custom exception class
pass
def timeout_handler(signum, frame): # Custom signal handler
raise TimeoutException
# Change the behavior of SIGALRM
@xingfanxia
xingfanxia / d.java
Created September 15, 2017 02:09
dchen
import java.util.Scanner;
/**
* Created by xingfanxia on 9/14/17.
*/
import java.util.Scanner;
public class Dchen {
public void dchen(int num) {