Skip to content

Instantly share code, notes, and snippets.

View amineasli's full-sized avatar
🏠
Working from home

Amine Asli amineasli

🏠
Working from home
  • Morocco
View GitHub Profile
@amineasli
amineasli / my_db_manager.py
Created April 30, 2022 04:16
A database manager class built on top of MySQL Connector/Python
"""
Copyright (c) 2022 Amine Asli, "MIAGE SIDI SLIMANE"
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
@amineasli
amineasli / App.js
Last active January 8, 2020 11:31
A React simple client for consuming the TrueFace webservice.
import React from "react";
import Webcam from "react-webcam";
import axios from "axios";
// Using a Local CORS Django based Proxy to bypass CORS issues
const proxyUrl = "http://127.0.0.1:8000/"
const videoConstraints = {
width: 300,
@amineasli
amineasli / enter-server.sh
Created December 7, 2016 00:42
To connect to remote servers using existing SSH keys and assuming a specific naming scheme for private keys (for example id_rsa-server_name)
#!/bin/bash
[ $# -eq 0 ] && { echo "Usage: $0 server"; exit 1; }
SERVER="$1"
SSH="/usr/bin/ssh"
USER="root"
IDENTITY="/root/.ssh/id_rsa-$SERVER"
$SSH $USER@$SERVER -i $IDENTITY
@amineasli
amineasli / mage-set-temp-perms
Last active February 24, 2016 17:50
Temporarily set permissive privileges and ownership for your Magento installation directory.
#!/bin/bash
#Check root access
if [ "$UID" != 0 ]
then
echo "This shell script must be run as root."
exit 2
fi
@amineasli
amineasli / mage-set-perms
Last active February 1, 2018 17:37
Setup Magento permissions/ownership following the recommendations of the official article : http://devdocs.magento.com/guides/m1x/install/installer-privileges_after.html
#!/bin/bash
#Check root access
if [ "$UID" != 0 ]
then
echo "This shell script must be run as root."
exit 2
fi
@amineasli
amineasli / fw-server.sh
Last active August 29, 2015 14:15
A simple Stateful Firewall using iptables for a Linux Webserver. The rules are given in an order that will prevent you from immediate disconnection of your SSH session, in case if you are logged into a remote machine.
#!/bin/bash
iptables -P FORWARD DROP
iptables -P OUTPUT ACCEPT
iptables -N TCP
iptables -N UDP
iptables -A INPUT -p icmp --icmp-type echo-request -m recent --name ping_limiter --set
iptables -A INPUT -p icmp --icmp-type echo-request -m recent --name ping_limiter --update --hitcount 6 --seconds 4 -j DROP
iptables -A INPUT -p icmp --icmp-type echo-request -j ACCEPT
iptables -A INPUT -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
iptables -A TCP -p tcp --dport 22 -j ACCEPT
@amineasli
amineasli / .htpasswd
Last active December 20, 2015 07:19
A Makefile for managing web projects on Ubuntu Server. It assumes that these environments are already setup and running correctly : LAMP environment : https://help.ubuntu.com/community/ApacheMySQLPHP, GIT server : http://git-scm.com/book/en/Git-on-the-Server-Setting-Up-the-Server, FTP server : https://help.ubuntu.com/10.04/serverguide/ftp-server…
AuthUserFile /path/.htpasswd
AuthName "Authorization required"
AuthType Basic
require valid-user