Skip to content

Instantly share code, notes, and snippets.

View mancubus77's full-sized avatar
🇦🇺

Mancubus mancubus77

🇦🇺
  • Just a small software company
  • Ku-ring-gai
View GitHub Profile
@mancubus77
mancubus77 / gist:1ef66501fbac7a5f3621efb411a6771f
Created February 17, 2017 23:07 — forked from firedfox/gist:2037945
find google ads with phantomjs
var page = require('webpage').create();
page.settings.loadImages = false;
page.onConsoleMessage = function(msg) { console.log(msg); };
page.onLoadFinished = function() {
page.evaluate(function() {
var getFrames = function(doc) {
var frames = doc.querySelectorAll('iframe');
for (var i = frames.length - 1; i >= 0; i--) {
var fdoc = frames[i].contentWindow.document;
@mancubus77
mancubus77 / gist:7a33de945ff9c6143ba703d55b148618
Created March 26, 2017 10:52
enable login with password in UEC ubuntu image
# Epitome
I want to have os image that can login with password.
download UEC image.
for example, this precise.
http://cloud-images.ubuntu.com/precise/current/precise-server-cloudimg-amd64-disk1.img
this image was forbidden to password login feature in terminal console.
it's reasonable for use of cloud image.

This is an example of using Linux Kernel's Transparent Proxy to route all TCP traffic to docker containers without having to resort to PROXY protocol which is not supported by some applications (e.g. sshd). To get the demo to work you only need vagrant installed:

git clone [this-gist] tproxy-demo
cd tproxy-demo
vagrant up
Q: How to provide Internet access to servers restricted via firewall rules?
A: Use SSH Tunnel and iptables
Create SSH tunnel to remote host
ssh -R9000:127.0.0.1:1025 <username>@<remote_server>
This command will listen port 9000 on remote machine (ssh server) and forward all packets via ssh tunnel to port 1025 on client machine (ssh client).
So the tunnel is done, but we need to make traffic pipeline. Let's configure our remote server which is located in well protected intranet. We need to forward all HTTP (or any other?) traffic on originated on remote server to the SSH tunnel. There are several ways to do this:
# clear cache memory from cli
sync && echo 3 | sudo tee /proc/sys/vm/drop_caches
# crontab
*/15 * * * * root sync && echo 3 > /proc/sys/vm/drop_caches
@mancubus77
mancubus77 / README
Created May 9, 2017 00:56 — forked from adilapapaya/README
Export Table Data to CSV using Javascript
Example code for exporting data in a table to a csv file.
<!DOCTYPE html>
<style>
.axis .domain {
display: none;
}
.text {
fill: black;
font-family: sans-serif
@mancubus77
mancubus77 / gist:755aee82d74cce75dd6272998f7859d6
Last active June 8, 2017 00:20
How to create animated GIF images of a screencast?
simgle command:
mplayer -ao null out.ogv -vo jpeg:outdir=output && convert output/* output.gif && convert output.gif -fuzz 10% -layers Optimize optimised.gif
from
https://askubuntu.com/questions/107726/how-to-create-animated-gif-images-of-a-screencast
First install this:
@mancubus77
mancubus77 / gist:9b68256c2774c04289dec922570b5a62
Created June 19, 2017 01:00
How to pass corporate proxy
From here:
https://www.howtoforge.com/linux-ntlm-authentication-proxy-isa-server-with-cntlm
About Cntlm proxy
Quoted from the official ctnlm sourceforge.net Website: "Cntlm is an NTLM / NTLM Session Response / NTLMv2 authenticating HTTP proxy intended to help you break free from the chains of Microsoft proprietary world. You can use a free OS and honor our noble idea, but you can't hide. Once you're behind those cold steel bars of a corporate proxy server requiring NTLM authentication, you're done with. The same even applies to 3rd party Windows applications, which don't support NTLM natively.
.
Here comes Cntlm. It stands between your applications and the corporate proxy, adding NTLM authentication on-the-fly. You can specify several "parent" proxies and Cntlm will try one after another until one works. All auth'd connections are cached and reused to achieve high efficiency. Just point your apps proxy settings at Cntlm, fill in cntlm.conf (cntlm.ini) and you're ready to do. This is useful on Windows, but