Skip to content

Instantly share code, notes, and snippets.

@moeiscool
moeiscool / superBasicProxy.js
Created September 14, 2020 18:41
superBasicProxy.js
const request = require('request')
const express = require('express')
const app = express()
const port = 3000
app.get('/', (req, res) => {
request('https://google.ca', function(err, requestResponse, body) {
res.end(body)
})
})
//Testing HTTP Proxy in Node.js
var http = require('http'),
httpProxy = require('http-proxy');
var proxy = httpProxy.createProxyServer({});
var server = http.createServer(function(req, res) {
proxy.web(req, res, { target: 'http://1.1.1.1:80' });
});
var listeningPort = 5050;
@moeiscool
moeiscool / fixForbes.js
Created June 17, 2020 03:15
Remove Forbes.com Anti-Ad-Blocker for CJS
// 1. get google chrome.
// 2. Install CJS (Allows running custom JavaScript on any website)
// 3. go to forbes.com and click CJS in the top right and paste the following code and save.
setTimeout(() => {console.log('hello');var element = document.querySelector('.fbs-auth__container'); element.parentNode.removeChild(element); document.querySelector('body').style = 'overflow:auto!important';},1000)
@moeiscool
moeiscool / NVIDIA GPU CUDA 10.1 Ubuntu 18.md
Created February 17, 2020 17:53 — forked from pliablepixels/NVIDIA GPU CUDA 10.1 Ubuntu 18.md
All the stuff to get CUDA 10.1 working with NVIDIA GPUs on Ubuntu 18.04. My notes.

All the stuff to get CUDA 10.1 working with NVIDIA GPUs on Ubuntu 18.04. My notes.

Step 1: Install NVIDIA Driver

  • sudo apt install nvidia-driver-430
  • reboot
  • run nvidia-smi. If it does not show your GPU, stop, fix. If this doesn't work, nothing else will (the rest of the stuff will compile, but won't work)
@moeiscool
moeiscool / blockFakeNewsOnYouTube.js
Last active May 1, 2024 12:33
Block/Delete Facebook Ads
//This works for MOST ads, not all of them. Anyone with updates please share.
//1. Install this plugin on Chrome : https://chrome.google.com/webstore/detail/custom-javascript-for-web/poakhlngfciodnhlhhgnaaelnpjljija?hl=en
//2. go to facebook.com and click the CJS icon in the top right.
//3. Copy and Paste this code into that window. Press Save.
//You don't need CJS, just some way to execute custom code. This should work on any browser capable of executing custom code on load.
// !!!!!!!!!!!!!!!! PASTE ONLY THE CONTENTS BELOW THIS LINE !!!!!!!!!!!!!!!!!!!!!
@moeiscool
moeiscool / clientSideFileDownloadWithProgress-jQuery.js
Last active May 1, 2024 12:33
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
}
@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.
@rogeriopradoj
rogeriopradoj / composer.json
Created July 2, 2017 17:07
mail.php - phpmailer + mailhog - send mail via smtp
{
"require": {
"phpmailer/phpmailer": "^5.2"
}
}
@GuillermoPena
GuillermoPena / nodeJs.crypto.calculatingHash.js
Created February 26, 2014 16:30
NodeJS - CRYPTO : How to calculate a hash from file or string
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"
@moeiscool
moeiscool / nodeJs.crypto.calculatingHash.js
Last active May 1, 2024 12:32 — forked from GuillermoPena/nodeJs.crypto.calculatingHash.js
NodeJS - CRYPTO : How to calculate a hash from file or string
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"