Skip to content

Instantly share code, notes, and snippets.

View eramax's full-sized avatar
🎯
Focusing

Ahmed Morsi eramax

🎯
Focusing
View GitHub Profile
@eramax
eramax / secure-server.sh
Created April 19, 2020 05:56 — forked from etoews/secure-server.sh
Secure an Ubuntu server
#!/bin/bash
# This script assumes you've created this server with a key pair. If you haven't, you're not getting back in.
# Switch to everett user
adduser --shell /bin/bash --gecos "User for managing feeds" --disabled-password --home /home/everett everett
adduser everett sudo
grep -q "^#includedir.*/etc/sudoers.d" /etc/sudoers || echo "#includedir /etc/sudoers.d" >> /etc/sudoers
( umask 226 && echo "everett ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/50_everett_sh )
mkdir /home/everett/.ssh
#!/bin/bash
#Server hardening script for cPanel servers
# Make sure only root can run this script
if [ "$(id -u)" != "0" ]; then
echo -e "\e[93m This script must be run as root \e[0m"
exit 1
fi
echo -e "\e[1;36;40m Server Hardening initiated \e[0m"
@eramax
eramax / hardening.sh
Created April 26, 2020 23:19 — forked from e23z/hardening.sh
[Ubuntu 16.04 Server Hardener] A script to make it easy to harden an Ubuntu 16.04 server. Its purpose is to setup simple security measures out-of-the-box, not to apply advanced security measures. #scripts #security #configuration #utils
#!/bin/bash
cd ~
read -s -p 'Sudo password: ' PASSWORD
echo ""
echo "Configuring server..."
read -p "What's the hostname of this machine? " NEW_HOSTNAME
echo $PASSWORD | sudo -Sk hostnamectl set-hostname $NEW_HOSTNAME
sudo sed -i -e "s/^127.0.0.1.*$/127.0.0.1 localhost $NEW_HOSTNAME/g" /etc/hosts
sudo dpkg-reconfigure tzdata
sudo service cron restart
@eramax
eramax / slugify.js
Created May 6, 2020 17:26 — forked from codeguy/slugify.js
Create slug from string in Javascript
function string_to_slug (str) {
str = str.replace(/^\s+|\s+$/g, ''); // trim
str = str.toLowerCase();
// remove accents, swap ñ for n, etc
var from = "àáäâèéëêìíïîòóöôùúüûñç·/_,:;";
var to = "aaaaeeeeiiiioooouuuunc------";
for (var i=0, l=from.length ; i<l ; i++) {
str = str.replace(new RegExp(from.charAt(i), 'g'), to.charAt(i));
}
@eramax
eramax / responsive-voice.js
Created May 11, 2020 21:40 — forked from anchetaWern/responsive-voice.js
responsive-voice.js
//Look for other responsivevoice instances
/*if (window.parent != null) {
var iframes = window.parent.document.getElementsByTagName('iframe');
for (var i = 0; i < iframes.length; i++) {
//iframes[i].style.width = "300px"
}
}*/
if (typeof responsiveVoice != 'undefined') {
console.log('ResponsiveVoice already loaded');
@eramax
eramax / git-hard-delete
Created June 4, 2020 11:00 — forked from srebalaji/git-hard-delete
Examples of git custom command
#!/bin/sh
branch=$1
if [ ! -z "$1" ]
then
git branch -D $branch
git push -d origin $branch
else
echo "Branch name is not specified"
http://cronus.allowed.org works for me, 2018.1.6
REM Delete eval folder with licence key and options.xml which contains a reference to it
for %%I in ("WebStorm", "IntelliJ", "CLion", "Rider", "GoLand", "PhpStorm", "Resharper", "PyCharm") do (
for /d %%a in ("%USERPROFILE%\.%%I*") do (
rd /s /q "%%a/config/eval"
del /q "%%a\config\options\other.xml"
)
)
REM Delete registry key and jetbrains folder (not sure if needet but however)
rmdir /s /q "%APPDATA%\JetBrains"
@eramax
eramax / installscript.sh
Created July 10, 2020 14:16 — forked from henriqueutsch/installscript.sh
manjaro install GTX 1050Ti
https://linuxconfig.org/how-to-install-the-nvidia-drivers-on-manjaro-18-linux
https://github.com/dglt1/optimus-switch-gdm
https://forum.manjaro.org/t/hdmi-monitor-not-working/94301/2
https://www.unixmen.com/install-oh-zsh-ubuntu-arch-linux-fedora/
https://starship.rs/guide/#%F0%9F%9A%80-installation
https://gist.github.com/tomgco/d08fcf551b5e3157173d2f0701b50b46
https://wiki.archlinux.org/index.php/VirtualBox
@eramax
eramax / http-benchmark.md
Created September 17, 2020 14:31 — forked from denji/http-benchmark.md
HTTP(S) Benchmark Tools / Toolkit for testing/debugging HTTP(S) and restAPI (RESTful)