Skip to content

Instantly share code, notes, and snippets.

View moeiscool's full-sized avatar
💭
Find me on Gitlab.com!

Moe moeiscool

💭
Find me on Gitlab.com!
View GitHub Profile
@moeiscool
moeiscool / install_ffmpeg_ubuntu.sh
Created June 12, 2016 18:13 — forked from xdamman/install_ffmpeg_ubuntu.sh
Install latest ffmpeg on ubuntu 12.04 or 14.04
#!/bin/bash
# Bash script to install latest version of ffmpeg and its dependencies on Ubuntu 12.04 or 14.04
# Inspired from https://gist.github.com/faleev/3435377
# Remove any existing packages:
sudo apt-get -y remove ffmpeg x264 libav-tools libvpx-dev libx264-dev
# Get the dependencies (Ubuntu Server or headless users):
sudo apt-get update
@moeiscool
moeiscool / drive-format-ubuntu.md
Created September 21, 2018 15:51 — forked from keithmorris/drive-format-ubuntu.md
Partition, format, and mount a drive on Ubuntu
@moeiscool
moeiscool / client.js
Created October 18, 2018 23:29 — forked from PaulMougel/client.js
File upload in Node.js to an Express server, using streams
// node: v0.10.21
// request: 2.27.0
var request = require('request');
var fs = require('fs');
var r = request.post("http://server.com:3000/");
// See http://nodejs.org/api/stream.html#stream_new_stream_readable_options
// for more information about the highWaterMark
// Basically, this will make the stream emit smaller chunks of data (ie. more precise upload state)
var upload = fs.createReadStream('f.jpg', { highWaterMark: 500 });
@moeiscool
moeiscool / send-whatsapp.js
Created November 7, 2018 21:01 — forked from yonisetiawan/send-whatsapp.js
Sending a WhatsApp message in Node.js
#!/usr/bin/env node
var http = require('http');
var instanceId = "YOUR_INSTANCE_ID_HERE"; // TODO: Replace it with your gateway instance ID here
var clientId = "YOUR_CLIENT_ID_HERE"; // TODO: Replace it with your Forever Green client ID here
var clientSecret = "YOUR_CLIENT_SECRET_HERE"; // TODO: Replace it with your Forever Green client secret here
var jsonPayload = JSON.stringify({
number: "12025550108", // TODO: Specify the recipient's number here. NOT the gateway number
var mediaJSON = { "categories" : [ { "name" : "Movies",
"videos" : [
{ "description" : "Big Buck Bunny tells the story of a giant rabbit with a heart bigger than himself. When one sunny day three rodents rudely harass him, something snaps... and the rabbit ain't no bunny anymore! In the typical cartoon tradition he prepares the nasty rodents a comical revenge.\n\nLicensed under the Creative Commons Attribution license\nhttp://www.bigbuckbunny.org",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4" ],
"subtitle" : "By Blender Foundation",
"thumb" : "images/BigBuckBunny.jpg",
"title" : "Big Buck Bunny"
},
{ "description" : "The first Blender Open Movie from 2006",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4" ],
@moeiscool
moeiscool / install-pptp-client-shinobi-video.sh
Created January 25, 2019 05:26
Install Shinobi Video PPTP VPN Client on Ubuntu 18.04
sudo apt install ppp pptp-linux
echo "/etc/ppp/chap-secrets"
DOMAIN="vpn.shinobi.video"
echo "VPN Server User"
read vpnuser
echo "VPN Server Password"
read vpnpass
chapsecret="$DOMAIN\\$vpnuser PPTP $vpnpass *"
if grep -q $chapsecret /etc/ppp/chap-secrets; then
echo "Already Set."
@moeiscool
moeiscool / README.md
Created July 14, 2019 17:05
Extract Frames from website as PNG images with PhantomJS
  1. run npm install phantomjs-prebuilt inside the directory where these files are located (launch.js and webpageRecord.js).
  2. run node launch.js
  3. See frames folder for images.
@moeiscool
moeiscool / fixDockerVersion.sh
Created July 18, 2019 03:36
Fix Docker version on Ubuntu so you can install nvidia-docker2
# Solution found here https://github.com/NVIDIA/nvidia-docker/issues/857#issuecomment-482379024
DOCKER_CE_VERSION=`apt-cache show nvidia-docker2 | grep -Po "(?<=docker-ce \(= )([^)]*)" | head -n 1`
apt-get -yq install nvidia-docker2 docker-ce=${DOCKER_CE_VERSION}
@moeiscool
moeiscool / tcpproxy.js
Created February 10, 2019 00:59 — forked from kfox/tcpproxy.js
A basic TCP proxy written in node.js
var net = require("net");
process.on("uncaughtException", function(error) {
console.error(error);
});
if (process.argv.length != 5) {
console.log("usage: %s <localport> <remotehost> <remoteport>", process.argv[1]);
process.exit();
}
@moeiscool
moeiscool / clientSideFileDownloadWithProgress-jQuery.js
Last active September 7, 2019 00:25
jQuery File Download with Progress
// Found at https://stackoverflow.com/questions/19126994/what-is-the-cleanest-way-to-get-the-progress-of-jquery-ajax-request
var url = "REMOTE_URL"
$.ajax({
xhr: function() {
var xhr = new window.XMLHttpRequest();
xhr.upload.addEventListener("progress", function(evt) {
if (evt.lengthComputable) {
var percentComplete = evt.loaded / evt.total;
//Do something with upload progress here
}