Skip to content

Instantly share code, notes, and snippets.

View ImanMousavi's full-sized avatar

Iman ImanMousavi

View GitHub Profile
@ImanMousavi
ImanMousavi / cloudSettings
Last active September 23, 2020 08:10 — forked from theorm/mongobak.py
Backup/Restore MongoDB collections or databases to/from S3
{"lastUpload":"2020-09-23T04:40:07.225Z","extensionVersion":"v3.4.3"}
@ImanMousavi
ImanMousavi / remove_watermarks.py
Created October 15, 2016 08:24
Removes the annoying watermarks of it-ebooks.info's downloaded eBooks
#!/usr/bin/env python3
import sys
import re
import shutil
import argparse
import binascii
#
# WTF: This is a quick tool I've hacked together to easily remove the meta
@ImanMousavi
ImanMousavi / countryinfo.py
Created April 16, 2018 05:19 — forked from pamelafox/countryinfo.py
Python list of country codes, names, continents, capitals, and pytz timezones
countries = [
{'timezones': ['Europe/Andorra'], 'code': 'AD', 'continent': 'Europe', 'name': 'Andorra', 'capital': 'Andorra la Vella'},
{'timezones': ['Asia/Kabul'], 'code': 'AF', 'continent': 'Asia', 'name': 'Afghanistan', 'capital': 'Kabul'},
{'timezones': ['America/Antigua'], 'code': 'AG', 'continent': 'North America', 'name': 'Antigua and Barbuda', 'capital': "St. John's"},
{'timezones': ['Europe/Tirane'], 'code': 'AL', 'continent': 'Europe', 'name': 'Albania', 'capital': 'Tirana'},
{'timezones': ['Asia/Yerevan'], 'code': 'AM', 'continent': 'Asia', 'name': 'Armenia', 'capital': 'Yerevan'},
{'timezones': ['Africa/Luanda'], 'code': 'AO', 'continent': 'Africa', 'name': 'Angola', 'capital': 'Luanda'},
{'timezones': ['America/Argentina/Buenos_Aires', 'America/Argentina/Cordoba', 'America/Argentina/Jujuy', 'America/Argentina/Tucuman', 'America/Argentina/Catamarca', 'America/Argentina/La_Rioja', 'America/Argentina/San_Juan', 'America/Argentina/Mendoza', 'America/Argentina/Rio_Gallegos', 'America/Argentina/Ushuai
@ImanMousavi
ImanMousavi / gist:551297ef64a2f42ca3952907984a5419
Created September 10, 2018 11:12
ethereum and bitcoin QR address regex
^([A-z]){3,10}\:[a-km-zA-HJ-NP-Z1-9]{25,34}(\?[a-z=0-9.&]+)?|^ethereum\:(0x[a-fA-F0-9]{40})([\[\]?a-z=0-9.&]+)?
@ImanMousavi
ImanMousavi / litecoin.conf
Created September 25, 2018 14:29
litecoin config
paytxfee=0.00000000
minrelaytxfee=0.00000000
minmempoolfee=0.00000000
mintxfee=0.0000001
discardfee=0
minrelayfee=0
@ImanMousavi
ImanMousavi / GenerateEthereumWallet.php
Last active November 28, 2022 06:14 — forked from onimusya/GenerateEthereumWallet.php
Generate Ethereum Wallet using PHP
<?php
require_once "vendor/autoload.php";
use Sop\CryptoTypes\Asymmetric\EC\ECPublicKey;
use Sop\CryptoTypes\Asymmetric\EC\ECPrivateKey;
use Sop\CryptoEncoding\PEM;
use kornrunner\keccak;
/**
@ImanMousavi
ImanMousavi / speedtest.py
Last active December 31, 2019 09:58
speed test in terminal
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2019 Iman Mousavi
# Use : curl -s https://gist.githubusercontent.com/irmaster/a7abd59737aea230426e52a1275bcb03/raw/5b5d0a012e279d2c5eb742aadf3f197f2a6c2ebb/speedtest.py | python -
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
@ImanMousavi
ImanMousavi / reset_sequence.sql
Created December 1, 2019 09:44
reset All sequence in postgresql
SELECT
tablename,
reset_sequence ( C.tablename, 'id', C.tablename || '_id_seq' )
FROM
pg_catalog.pg_tables AS "c"
WHERE
schemaname <> 'pg_catalog'
AND schemaname <> 'information_schema'
AND tablename NOT IN ( 'layer', 'spatial_ref', 'spatial_ref_sys', 'combination_has_province', 'statement', 'combination_has_category', 'combination_has_city', 'discount_has_category', 'value' );
@ImanMousavi
ImanMousavi / socket_check.py
Created February 16, 2020 12:45
check network port in python
# test if an [ip:port] is open
import socket
def isOpen(ip,port):
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
try:
s.connect((ip, int(port)))
s.shutdown(2)
return True
@ImanMousavi
ImanMousavi / start_docker_registry.bash
Last active June 7, 2020 13:44 — forked from PieterScheffers/start_docker_registry.bash
Start docker registry with letsencrypt certificates (Linux Ubuntu)
#!/usr/bin/env bash
# install docker
# https://docs.docker.com/engine/installation/linux/ubuntulinux/
# install docker-compose
# https://docs.docker.com/compose/install/
# install letsencrypt
# https://www.digitalocean.com/community/tutorials/how-to-secure-nginx-with-let-s-encrypt-on-ubuntu-16-04