Skip to content

Instantly share code, notes, and snippets.

View hadisfr's full-sized avatar

H@di hadisfr

View GitHub Profile
@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

@hadisfr
hadisfr / outline-server-setup.md
Last active October 20, 2024 17: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 / 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/
#!/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 / add-p.md
Last active December 1, 2019 15:53 — forked from mattlewissf/add-p.md
Lightning Talk: Git add -p

git add -p is your friend

git add -p is basically "git add partial (or patch)"

Patch mode allows you to stage parts of a changed file, instead of the entire file. This allows you to make concise, well-crafted commits that make for an easier to read history. This feature can improve the quality of the commits. It also makes it easy to remove parts of the changes in a file that were only there for debugging purposes - prior to the commit without having to go back to the editor.

It allows you to see the changes (delta) to the code that you are trying to add, and lets you add them (or not) separately from each other using an interactive prompt. Here's how to use it:

from the command line, either use

  • git add -p
@hadisfr
hadisfr / xsel.el
Last active June 18, 2020 10:55 — forked from ossdev-somewhere/xsel.el
Emacs-nox <-> X11 clipboard transfer
; You need "xsel" program.
(defun x-paste ()
"insert text on X11's clipboard to current buffer."
(interactive)
(insert (shell-command-to-string "xsel -b")))
(defun x-copy ()
"copy text on local kill-ring to X11's clipboard."
(interactive)
ZOOKEEPER_IP=esv4-hcl197.grid.linkedin.com
BOOTSTRAP_SERVER_IP=esv4-hcl198.grid.linkedin.com
# Producer
# Setup
bin/kafka-topics.sh --zookeeper $ZOOKEEPER_IP:2181 --create --topic test-rep-one --partitions 6 --replication-factor 1
bin/kafka-topics.sh --zookeeper $ZOOKEEPER_IP:2181 --create --topic test --partitions 6 --replication-factor 3

Use Proxy for Git/GitHub

Generally, the Git proxy configuration depends on the Git Server Protocol you use. And there're two common protocols: SSH and HTTP/HTTPS. Both require a proxy setup already. In the following, I assume a SOCKS5 proxy set up on localhost:1080. But it can also be a HTTP proxy. I'll talk about how to set up a SOCKS5 proxy later.

SSH Protocol

When you do git clone ssh://[user@]server/project.git or git clone [user@]server:project.git, you're using the SSH protocol. You need to configurate your SSH client to use a proxy. Add the following to your SSH config file, say ~/.ssh/config:

ProxyCommand nc -x localhost:1080 %h %p