Skip to content

Instantly share code, notes, and snippets.

View mort3za's full-sized avatar
🕸️

Morteza Ziyaeimehr mort3za

🕸️
View GitHub Profile
@mort3za
mort3za / torrc
Last active March 14, 2024 14:44
Using tor with bridges, torrc example config (bit.ly/m3torrc)
# sudo apt-get install obfs4proxy obfsproxy tor
# sudo vi /etc/tor/torrc
UseBridges 1
ClientTransportPlugin obfs3 exec /usr/bin/obfsproxy managed
ClientTransportPlugin obfs4 exec /usr/bin/obfs4proxy managed
# send email to bridges@torproject.org with body `get transport obfs4` you can get new bridges.
bridge obfs4 195.154.49.15:44705 BACD07DACE996093DC7635F33A98C49... cert=xc/wtKNWADfJQf232xSXT0WpzsaINw6fgPvZBy5Rkw4.../ypaZPDug9L... iat-mode=0
@mort3za
mort3za / install-php5.6-ubuntu.sh
Last active February 15, 2024 14:16
Install php 5.6 and composer in ubuntu 18.04
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install php5.6
php --version
sudo apt-get install php5.6-curl php5.6-xml
sudo apt-get install composer
@mort3za
mort3za / git-auto-sign-commits.sh
Last active January 30, 2024 10:31
Auto sign your git commits
# Generate a new pgp key: (better to use gpg2 instead of gpg in all below commands)
gpg --gen-key
# maybe you need some random work in your OS to generate a key. so run this command: `find ./* /home/username -type d | xargs grep some_random_string > /dev/null`
# check current keys:
gpg --list-secret-keys --keyid-format LONG
# See your gpg public key:
gpg --armor --export YOUR_KEY_ID
# YOUR_KEY_ID is the hash in front of `sec` in previous command. (for example sec 4096R/234FAA343232333 => key id is: 234FAA343232333)
@mort3za
mort3za / to-mp4.sh
Last active December 2, 2023 01:45
Convert video to mp4 acc with ffmpeg, https://bit.ly/m3ffmpeg
# install ffmpeg on windows machines: http://www.wikihow.com/Install-FFmpeg-on-Windows
ffmpeg -i inputfile.mp4 -r 24 -crf 18 -vcodec h264 -acodec aac outputfile.mp4
@mort3za
mort3za / browserstack-local.txt
Created March 17, 2021 21:59
How to use BrowserStack to see local development page (localhost)?
1. Download the BrowserStack binary from here:
https://www.browserstack.com/docs/live/local-testing
And setup it with your API key.
2. Map bs-local.com to 127.0.0.1 in your hosts file.
3. Build your web application with production environment (If you have a speedy internet connection, you may want to run it with development env)
4. Run your local server (localhost:3000 or similar) and test bs-local.com:3000 works too.
@mort3za
mort3za / gitlab-bookmarklets.md
Last active March 9, 2023 11:53
Some Gitlab bookmarklets. Use https://www.gibney.org/bookmarklet_editor to convert code to JS and edit it.

Cancel all jobs in column test-run, except those entered in prompt box:

javascript:(function()%7Bconst%20jobs%20%3D%20prompt('Enter%20jobs%2C%20comma%20separated').split('%2C')%3B%0Aconst%20contains%20%3D%20jobs.map(i%3D%3E%60%3Acontains(%22%24%7Bi%7D%22)%60).join()%3B%0A%24(%60%5Bdata-testid%3D%22stage-column%22%5D%3Acontains(%22test-run%22)%20.ci-job-component%3Anot(%24%7Bcontains%7D)%20.cancel%60).trigger('click')%7D)()
@mort3za
mort3za / ssh-key-login.sh
Created December 28, 2022 20:16
How to login to a Linux server with a second ssh key
# generate your new ssh key (e.g. id_rsa_second)
ssh-keygen
# add the public key to server manually (from your host panel) or by:
ssh-copy-id -i ~/.ssh/id_rsa_second.pub root@server_ip_address_here
vim ~/.ssh/config
# enter this code:
Host server_ip_address_here
AddKeysToAgent yes
@mort3za
mort3za / relative-time.ts
Created April 2, 2022 18:02
Relative time with automatic period detection
// example: const mydate = getRelativeTime('Sat Apr 02 2022 14:00:00 GMT');
// console.log(getRelativeTime(mydate);
// output: 4 hr. ago
// (while current time is 18:00)
export const getRelativeTime = (date: string): string => {
const unix = new Date(date).getTime();
type Periods = [string, number][];
const second = 1000;
var suitcase = '25618645791'