Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View Iman's full-sized avatar

Iman Samizadeh Iman

View GitHub Profile
@Iman
Iman / CP progress bar
Created February 3, 2012 11:23
Progress bar for CP
#!/bin/sh
cp_p()
{
strace -q -ewrite cp -- "${1}" "${2}" 2>&1 \
| awk '{
count += $NF
if (count % 10 == 0) {
percent = count / total_size * 100
printf "%3d%% [", percent
for (i=0;i<=percent;i++)
@Iman
Iman / gpg-agent daemon
Created December 4, 2012 16:54
gpg-agent daemon
#!/bin/bash
#####
#### GPG-AGENT stuff
####GET_TTY=`tty`
####export $GET_TTY
####$HOME/<somercdir>/gpg-agent-start.sh
#####
# Decide wether to start gpg-agent daemon.
@Iman
Iman / ipHealthTest.cs
Last active December 19, 2015 15:29
Validate alive IP address in C# (IP health test)
using System;
using System.Net;
using System.Threading;
using System.Net.Sockets;
class test2 {
private static readonly string[] listA = new string[] {"173.194.00.001", "72.233.127.00", "2607:f8b0:4003:c00::6a", "foo"};
private static bool IsIP4;
private static bool isUp;
@Iman
Iman / gitHistoryClean
Last active August 29, 2015 14:24
Clean git history after file deleted from git
#!/bin/bash
# remove all paths passed as arguments from the history of the repo
git filter-branch --index-filter "git rm -rf --cached --ignore-unmatch config/*.ini" HEAD
# remove the temporary history git-filter-branch otherwise leaves behind for a long time
rm -rf .git/refs/original/ && git reflog expire --all && git gc --aggressive --prune
git filter-branch -f --index-filter "git rm --cached --ignore-unmatch app/config/*.ini" --prune-empty -- --all
@Iman
Iman / clean.sh
Last active April 15, 2024 16:50
Free up disk space on Ubuntu - clean log, cache, archive packages/apt archives, orphaned packages, old kernel and remove the trash
#!/bin/sh
#Check the Drive Space Used by Cached Files
du -sh /var/cache/apt/archives
#Clean all the log file
#for logs in `find /var/log -type f`; do > $logs; done
logs=`find /var/log -type f`
for i in $logs
@Iman
Iman / .bash_profile
Created August 27, 2015 09:36
Git profile + git info like svn info
alias gi='~/git-info.sh'
#!/usr/bin/env bash
#find /var/www/ -name "*.png" -print0 | xargs -0 sudo chmod +w *.png
find /var/www/ -name "*.png" -print0 | xargs -0 sudo optipng -o7
#find /var/www/ -name "*.jpg" -print0 | xargs -0 sudo chmod +w *.jpg
find /var/www/ -name "*.jpg" -print0 | xargs -0 sudo jpegoptim -m 90 -t
@Iman
Iman / install_ffmpeg_libfdkaac.sh
Last active May 3, 2023 16:34 — forked from rafaelbiriba/install_ffmpeg_libfdkaac.sh
Install FFmpeg with libfdk_aac support (For Ubuntu)
#!/usr/bin/env bash
#Credit to @rafaelbiriba and @dustball
export BASE=/opt
echo "deb http://www.deb-multimedia.org stretch main non-free" >> /etc/apt/sources.list
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 5C808C2B65558117
apt-get update
apt-get -y install build-essential autoconf automake cmake libtool git \
@Iman
Iman / m3u8-to-mp4.md
Created October 12, 2021 19:36 — forked from tzmartin/m3u8-to-mp4.md
m3u8 stream to mp4 using ffmpeg

1. Copy m3u8 link

Alt text

2. Run command

echo "Enter m3u8 link:";read link;echo "Enter output filename:";read filename;ffmpeg -i "$link" -bsf:a aac_adtstoasc -vcodec copy -c copy -crf 50 $filename.mp4
@Iman
Iman / http2_apache2_ubuntu18.04.md
Created January 23, 2022 01:10 — forked from GAS85/http2_apache2_ubuntu18.04.md
How to Enable HTTP/2 in Apache 2.4 on Ubuntu 18.04

Requirements

  • A self-managed VPS or dedicated server with Ubuntu 18.04 running Apache 2.4.xx.
  • A registered domain name with working HTTPS (TLS/SSL). HTTP/2 only works alongside HTTPS because most browsers, including Firefox and Chrome, don’t support HTTP/2 in cleartext (non-TLS) mode.

Step 1: Install Apache2