Skip to content

Instantly share code, notes, and snippets.

View hadisfr's full-sized avatar

H@di hadisfr

View GitHub Profile
@hadisfr
hadisfr / pdf_stamp.sh
Last active September 10, 2023 10:39
use pdftk to stamp a pdf on another one
#!/usr/bin/env bash
# PDF Stamper Scrtipt
#
# Author: H@di (info@hadisafari.ir)
#
# pdftk in.pdf multistamp stamp.pdf output out.pdf
# https://www.pdflabs.com/docs/how-to-add-headers-footers-watermarks-and-stamps-to-pdf/
#
@hadisfr
hadisfr / subtitle_corrcetor.sh
Last active June 5, 2018 00:17
convert subtitles' encoding from Arabic(Windows) to UTF-8
#!/usr/bin/env bash
for f in `find . -name "*.srt"`; do
iconv -f ms-arab -t utf8 $f > ${f%".srt"}.u.srt
echo -e ${f%".srt"}.u.srt
done
@hadisfr
hadisfr / bash_profile
Last active October 5, 2017 21:05
part of ~/.bash_profile
# ~/.bash_profile
alias ls='ls --color=auto'
alias grep="grep --color=auto"
alias diffstat="diffstat -C"
alias hiddneFilesShow='defaults write com.apple.finder AppleShowAllFiles YES && rm ~/.DS_Store; killall Finder /System/Library/CoreServices/Finder.app'
alias hiddneFilesHide='defaults write com.apple.finder AppleShowAllFiles NO && rm ~/.DS_Store; killall Finder /System/Library/CoreServices/Finder.app'
function aria2webui(){
@hadisfr
hadisfr / agnoster_bash.sh
Last active July 20, 2018 05:34
a bash theme like agnoster zsh theme - migrated to https://github.com/hadisfr/agnoster_bash
#!/usr/bin/bash
# Agnoster BASH Theme
#
# Author: H@di(info@hadisafari.ir)
#
# Usage: 1. set a powerline-compatible font for terminal
# 2. append this file to your ~/.bash_profile
#
# • powerline-compatible fonts: https://github.com/powerline/fonts/tree/master/SourceCodePro
@hadisfr
hadisfr / compile_kernel.bash
Last active July 20, 2018 05:48
a bash script to compile and run linux kernel using qemu and gdb - migrated to https://github.com/hadisfr/compile_kernel
#!/usr/bin/env bash
# a script to compile and run linux kernel using qemu and gdb
#
# author: hadi_sfr(info@hadisafari.ir)
#
# Usage:
# Download .tar.gz kernel file from https://www.kernel.org/pub/linux/kernel/
# Put .tar.gz file besdie this script
# Run the script
@hadisfr
hadisfr / DE2_TOP.v
Last active October 19, 2017 13:58
some ALTERA DE2 FPGA files for Quartus II
// ============================================================================
// Copyright (c) 2012 by Terasic Technologies Inc.
// ============================================================================
// Permission:
// Terasic grants permission to use and modify this code for use
// in synthesis for all Terasic Development Boards and Altera Development
// Kits made by Terasic. Other use of this code, including the selling
// ,duplication, or modification of any portion is strictly prohibited.
@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 March 25, 2024 12:17 — 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 / 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 / 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