Skip to content

Instantly share code, notes, and snippets.

View hadisfr's full-sized avatar

H@di hadisfr

View GitHub Profile
#!/bin/bash
# Run in go using -
# <exec command="bash">
# <arg>-c</arg>
# <arg>curl -s https://gist.githubusercontent.com/hadisfr/57750e9ae05a57989f17742536f82ee3/raw/ansi-color-test.sh | bash</arg>
# </exec>
bash <( curl -s https://raw.githubusercontent.com/fidian/ansi/master/ansi) --color-table
@hadisfr
hadisfr / svg2tex.sh
Created August 21, 2018 15:11
convert svg files to LaTeX-compatible pdf
function svg2tex {
_addr=$(readlink -f $1)
inkscape -D -z --file=$_addr --export-pdf=${_addr/.svg/.pdf} --export-latex
}
@hadisfr
hadisfr / vpn.sh
Last active August 13, 2018 17:01
run cisco anyconnect vpn client from macOS terminal
#!/bin/sh
/opt/cisco/anyconnect/bin/vpn -s << EOF
connect hosthere:porthere
usernamehere
passwordhere
exit
EOF
@hadisfr
hadisfr / lint-c++.sh
Created August 13, 2018 16:48
lint c++ codes of a project using clang-format
find . -name *.cpp -exec bash -c 'cmp <(clang-format --style=LLVM $0) $0' {} \;
@hadisfr
hadisfr / Python2.7-Pip-Virtualenv.md
Last active August 6, 2018 06:27 — forked from hrushikesh198/Python2.7-Pip-Virtualenv.md
Python2.7, Pip, Virtualenv Installation on Mac or Linux machines for the current user without sudo access

Installing Python2.7

If you download a different version it should work similarly.

cd ~
wget https://www.python.org/ftp/python/2.7.13/Python-2.7.13.tgz
tar -xzvf Python-2.7.13.tgz
cd Python-2.7.13
./configure 
make altinstall prefix=~/.local/
@hadisfr
hadisfr / python_on_ubuntu.md
Last active January 14, 2024 17:03
a short guide to install python3 and pip3 on Ubuntu Server

Python on Ubuntu

Tricks

Ubuntu

Disable X-Server on Ubuntu Desktop

  • edit /etc/default/grub and change
@hadisfr
hadisfr / Varnish.md
Last active August 22, 2018 16:57
A tutorial on how to set-up cache servers (varnish, nginx) - https://github.com/esihaj/cache-tutorial

Varnish Cache

Varnish is an HTTP accelerator and a useful tool for speeding up a server, especially during a times when there is high traffic to a site. It works by redirecting visitors to static pages whenever possible and only drawing on the virtual private server itself if there is a need for an active process.

Table of contents

[TOC]

How to Install

Download and build

Latest varnish version: 4.1.3

@hadisfr
hadisfr / shadowsocks_on_ubuntu.md
Created July 20, 2018 05:20
a simple guid to run a shadowsocks proxy on Ubuntu

Run a Shadowsocks Proxy Server on Ubuntu

Install Shadowsocks

It's possible to install ss-server by apt:

apt-get install shadowsocks-libev
@hadisfr
hadisfr / outline-server-setup.md
Last active December 23, 2024 16:30 — forked from okeehou/outline-server-setup.md
How to setup an Outline VPN Server on Ubuntu 16.04

How to setup an Outline VPN Server on Ubuntu 16.04 Server

This guide will show you how to install Outline Server on an Ubuntu 16.04 Server and use Outline Manager.

Install Outline Manager

Outline Manager supports Windows, macOS and Linux.

Outline Manager for Windows

@hadisfr
hadisfr / Virtual Box Host Only Static IP.md
Last active February 18, 2018 23:29 — forked from pjdietz/Virtual Box Host Only Static IP.md
VirtualBox Host-Only Adapter with Static IP

VirtualBox Host-Only Static IP

My typical setup for a development box in VirtualBox uses two NICs. The first uses NAT to allow the box to communicate with the outside world through my host computer’s network connection. (NAT is the default, so shouldn't require any setup.) The second is a "host-only" connection that allows my host and guest to interact.

To create a host-only connection in VirtualBox, start by opening the preferences in VirtualBox. Go to the "Network" tab, and addd a Host-only Network. Modify the host-only network, and disable DHCP. Make a note of the IP address. (Feel free to set the IP address as well, if you like.)

Next, assign this host-only adapter to the virtual machine. Select the VM and press "Settings". Go to the "Network" tab, and select "Adpater 2". Enable the adapter, set it to a "Host-only Adapter", and select the adpater you created above.

NAT Troubleshooting