Skip to content

Instantly share code, notes, and snippets.

Avatar

Iman Iman

View GitHub Profile
@Iman
Iman / http2_apache2_ubuntu18.04.md
Created Jan 23, 2022 — forked from GAS85/http2_apache2_ubuntu18.04.md
How to Enable HTTP/2 in Apache 2.4 on Ubuntu 18.04
View http2_apache2_ubuntu18.04.md

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

@Iman
Iman / m3u8-to-mp4.md
Created Oct 12, 2021 — forked from tzmartin/m3u8-to-mp4.md
m3u8 stream to mp4 using ffmpeg
View m3u8-to-mp4.md

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 / install_ffmpeg_libfdkaac.sh
Last active Jan 8, 2021 — forked from rafaelbiriba/install_ffmpeg_libfdkaac.sh
Install FFmpeg with libfdk_aac support (For Ubuntu)
View install_ffmpeg_libfdkaac.sh
#!/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 \
View gist:901000acda7dc41ab238313a4c69a557
#!/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 / .bash_profile
Created Aug 27, 2015
Git profile + git info like svn info
View .bash_profile
alias gi='~/git-info.sh'
@Iman
Iman / clean.sh
Last active Jul 29, 2022
Free up disk space on Ubuntu - clean log, cache, archive packages/apt archives, orphaned packages, old kernel and remove the trash
View clean.sh
#!/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 / gitHistoryClean
Last active Aug 29, 2015
Clean git history after file deleted from git
View gitHistoryClean
#!/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 / ipHealthTest.cs
Last active Dec 19, 2015
Validate alive IP address in C# (IP health test)
View ipHealthTest.cs
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;
View 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 / CP progress bar
Created Feb 3, 2012
Progress bar for CP
View CP progress bar
#!/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++)