Skip to content

Instantly share code, notes, and snippets.

View imasimali's full-sized avatar
🏆

Asim Ali imasimali

🏆
View GitHub Profile
@imasimali
imasimali / Export-Google-Shared-Domain-Contacts-Directory.js
Created December 4, 2022 13:29
Browser JavaScript to export contacts data from google shared domain contacts directory. When export is turned off by administrator.
function sleep(ms) {
return new Promise((resolve) => {
setTimeout(resolve, ms);
});
}
window.contactsData = new Set();
window.scroller =
document.querySelectorAll(
".ZvpjBb.C8Dkz"
@imasimali
imasimali / gcc one command run
Created November 17, 2021 18:16
Run your C program in gcc with one line.
Add aliases in your .(shell)rc:
alias gcb='f(){ gcc "$1" -o "$2"; ./"$2"; unset -f f; }; f'
alias gcr='f(){ gcc "$1"; ./a.out; rm -f a.out; unset -f f; }; f'
The first modifies the name of the binary and executes it. The second compiles, runs, and delete the binary.
Demo gcb:
~$ gcb main.c build
Hello World
@imasimali
imasimali / Creating a VNC Service File
Last active July 28, 2021 17:06
Use this code to set up the VNC server as a systemd service. This will make it possible to start, stop, and restart it as needed, like any other systemd service.
sudo nano /etc/systemd/system/[email protected]
PASTE this code (dont forget to change the username):
"""
[Unit]
Description=Start TightVNC server at startup
After=syslog.target network.target
[Service]
Type=forking
@imasimali
imasimali / Google Drive to S3 Uploader Colab
Created July 4, 2021 10:41
Upload files from google drive to S3 directly using Google Colab - I am using Linode S3
## Create a connection to Linode S3 file storage
!pip install boto3
AWS_S3_ENDPOINT_URL = f'https://{REGION_NAME}.linodeobjects.com'
import boto3
s3 = boto3.client('s3',
region_name = 'REGION_NAME',
endpoint_url = AWS_S3_ENDPOINT_URL,
aws_access_key_id = 'XXXXXXXXXXXXXXXXXXXX',
aws_secret_access_key = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
sudo nano /etc/apt/sources.list
#Write this into list
deb http://deb.debian.org/debian stretch-backports main contrib non-free
deb-src http://deb.debian.org/debian stretch-backports main contrib non-free
sudo apt update
sudo apt install python-certbot-nginx -t stretch-backports
@imasimali
imasimali / vnc-security
Last active March 14, 2021 16:19
Ubuntu Uncomplicated Firewall (ufw) rules to allow specific IP addresses to access VNC
## allow ssh connections (otherwise you will lock yourself out)
sudo ufw allow 22/tcp
## allow VNC connections from one IP address (edit the port if you don't use 5901)
sudo ufw allow from 12.34.56.78/24 to any port 5901
## reject all other incoming connections
sudo ufw default reject incoming
## enable the firewall
sudo ufw enable
@imasimali
imasimali / phpmysql.yml
Created February 16, 2021 19:50
PHPMYSQL (Docker Compose)
version: '3.1'
services:
db:
image: mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: mysqlrootpassword
MYSQL_DATABASE: test_db
ports:
- "3308:3306"
@imasimali
imasimali / magento-bitnami.yml
Created February 16, 2021 19:48
MAGENTO - BITNAMI (Docker-Compose)
version: '2'
services:
mariadb:
image: 'docker.io/bitnami/mariadb:10.3-debian-10'
environment:
- ALLOW_EMPTY_PASSWORD=yes
- MARIADB_USER=bn_magento
- MARIADB_DATABASE=bitnami_magento
volumes:
- 'mariadb_data:/bitnami/mariadb'
### Keybase proof
I hereby claim:
* I am imasimali on github.
* I am asimali (https://keybase.io/asimali) on keybase.
* I have a public key whose fingerprint is 1522 E77A 5B6A 8A57 9813 E07C D83D 8077 8435 C8B3
To claim this, I am signing this object: