Skip to content

Instantly share code, notes, and snippets.

💭
Find me on Gitlab.com!

Moe moeiscool

💭
Find me on Gitlab.com!
Block or report user

Report or block moeiscool

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@moeiscool
moeiscool / clientSideFileDownloadWithProgress-jQuery.js
Last active Sep 7, 2019
jQuery File Download with Progress
View clientSideFileDownloadWithProgress-jQuery.js
// 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
}
@moeiscool
moeiscool / fixDockerVersion.sh
Created Jul 18, 2019
Fix Docker version on Ubuntu so you can install nvidia-docker2
View fixDockerVersion.sh
# 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 / README.md
Created Jul 14, 2019
Extract Frames from website as PNG images with PhantomJS
View README.md
  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 / nodeJs.crypto.calculatingHash.js
Last active Apr 4, 2019 — forked from GuillermoPena/nodeJs.crypto.calculatingHash.js
NodeJS - CRYPTO : How to calculate a hash from file or string
View nodeJs.crypto.calculatingHash.js
var crypto = require('crypto')
, fs = require('fs')
// Algorithm depends on availability of OpenSSL on platform
// Another algorithms: 'sha1', 'md5', 'sha256', 'sha512' ...
var algorithm = 'sha1'
, shasum = crypto.createHash(algorithm)
// Updating shasum with file content
var filename = __dirname + "/anything.txt"
View gist:589c4c235b85e349404cacd94d553c33
Originall From: Posted 2015-05-29 http://ubwg.net/b/full-list-of-ffmpeg-flags-and-options
This is the complete list that’s outputted by ffmpeg when running ffmpeg -h full.
usage: ffmpeg [options] [[infile options] -i infile]… {[outfile options] outfile}…
Getting help:
-h — print basic options
-h long — print more options
-h full — print all options (including all format and codec specific options, very long)
@moeiscool
moeiscool / multiple-files-remove-prefix.md
Created Mar 2, 2019 — forked from larshaendler/multiple-files-remove-prefix.md
Remove prefix from multiple files in Linux console
View multiple-files-remove-prefix.md

Bash

for file in prefix*; do mv "$file" "${file#prefix}"; done;

The for loop iterates over all files with the prefix. The do removes from all those files iterated over the prefix.

Here is an example to remove "bla_" form the following files:

bla_1.txt
bla_2.txt
@moeiscool
moeiscool / tcpproxy.js
Created Feb 10, 2019 — forked from kfox/tcpproxy.js
A basic TCP proxy written in node.js
View tcpproxy.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 / install-pptp-client-shinobi-video.sh
Created Jan 25, 2019
Install Shinobi Video PPTP VPN Client on Ubuntu 18.04
View install-pptp-client-shinobi-video.sh
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 / install-pptp-vpn-server.sh
Created Jan 25, 2019
Install PPPTP VPN Server on Ubuntu 18.04
View install-pptp-vpn-server.sh
echo "======================="
echo "Installing PPTP VPN Server..."
echo "======================="
apt install pptpd -y
echo "Setting VPN Server IP : localip 172.16.0.1"
if grep -q "localip 172.16.0.1" /etc/pptpd.conf; then
echo "Already set."
else
sed -i 's/localip/#localip/g' /etc/pptpd.conf
echo "localip 172.16.0.1" >> /etc/pptpd.conf
View gist:804ce760b62e85c2ec4b761a0c6b0f79
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" ],
You can’t perform that action at this time.