Skip to content

Instantly share code, notes, and snippets.

View zinzinday's full-sized avatar
🏠
Working from home

Nghia Nguyen zinzinday

🏠
Working from home
View GitHub Profile
#!/bin/bash
#sudo -i
cd /tmp
printf "Add repositories"
sudo apt-get install software-properties-common
sudo sudo apt-get install python-software-properties
sudo add-apt-repository ppa:webupd8team/java
sudo add-apt-repository ppa:webupd8team/sublime-text-3
sudo add-apt-repository ppa:nginx/stable
sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xcbcb082a1bb943db
@zinzinday
zinzinday / ffmpeg.sh
Created September 30, 2016 19:23 — forked from charlee/ffmpeg.sh
ffmpeg tips
# losslessly concat mp4 files
ffmpeg -i input1.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts intermediate1.ts
ffmpeg -i input2.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts intermediate2.ts
ffmpeg -i "concat:intermediate1.ts|intermediate2.ts" -c copy -bsf:a aac_adtstoasc output.mp4
# concat files with the same format
# 1. create a file list
file '/path/to/file1'
file '/path/to/file2'
file '/path/to/file3'
@zinzinday
zinzinday / videoinfo.js
Created September 2, 2017 23:49
Get video information using ffprobe and url
var exec = require('child_process').exec;
var url = 'https://URL';
var command = 'curl --silent ' + url + '| ffprobe pipe:0 -print_format json -show_format';
exec(command, function callback(error, stdout, stderr){
if(stderr.indexOf("Invalid data") > -1) {
console.log("Error!");
}
These are the steps that were previously in the question - they have been migrated to this answer.
Having found that it is possible to generate a Facebook Page Access Token that does not expire (with help from @Igy), here is a clear, step-by-step quide for all those looking to the same:
Make sure you are the admin of the FB page you wish to pull info from
Create a FB App (should be with the same user account that is the page admin)
Head over to the Facebook Graph API Explorer
On the top right, select the FB App you created from the "Application" drop down list
Click "Get Access Token"
Make sure you add the manage_pages permission
Convert this short-lived access token into a long-lived one by making this Graph API call: https://graph.facebook.com/oauth/access_token?client_id=<your FB App ID >&client_secret=<your FB App secret>&grant_type=fb_exchange_token&fb_exchange_token=<your short-lived access token>
<?xml version="1.0" encoding="utf-8"?>
<!-- https://gist.github.com/kalehv/bae765c756e94455ed88 -->
<resources>
<color name="red_50">#ffebee</color>
<color name="red_100">#ffcdd2</color>
<color name="red_200">#ef9a9a</color>
<color name="red_300">#e57373</color>
<color name="red_400">#ef5350</color>
<color name="red_500">#f44336</color>
@zinzinday
zinzinday / nginx.conf
Created November 24, 2017 22:08 — forked from turtlesoupy/nginx.conf
node.js upstream nginx config
http {
proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=one:8m max_size=3000m inactive=600m;
proxy_temp_path /var/tmp;
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
gzip on;
gzip_comp_level 6;
@zinzinday
zinzinday / signed_request.js
Created March 30, 2018 21:33 — forked from sorenlouv/signed_request.js
Parse signed request from Facebook cookie, and exchange code to access token
var request = require('request-promise');
var crypto = require('crypto');
var config = {...};
function getAccessToken(cookies) {
var cookieName = 'fbsr_' + config.client_id;
var signedRequest = cookies[cookieName];
var code = getCode(signedRequest);
return exchangeCodeForAccessToken(code);
};
@zinzinday
zinzinday / xcarchive2ipa
Created September 5, 2018 14:25 — forked from samma835/xcarchive2ipa
How to convert .xcarchive to .ipa
xcodebuild -exportArchive -exportFormat ipa -archivePath {PATH}/MyApp.xcarchive -exportPath ~/Desktop/MyApp.ipa
find . -name "fgh*" -type f -print0 | xargs -0 -I {} sh -c 'mv "{}" "$(dirname "{}")/`echo $(basename "{}") | sed 's/^fgh/jkl/g'`"'
@zinzinday
zinzinday / file-upload.ts
Created February 2, 2019 12:01 — forked from victor-carv/file-upload.ts
File upload - Ionic 3
import {Component} from '@angular/core';
import {
ActionSheetController,
AlertController,
IonicPage,
LoadingController,
ModalController,
NavParams,
ToastController
} from 'ionic-angular';