Skip to content

Instantly share code, notes, and snippets.

@eladc
eladc / img2icons.py
Created Mar 28, 2015
Convert a png image to different icons for mobile devices
View img2icons.py
#!/usr/bin/env python
from os import path, makedirs
from glob import glob
from PIL import Image
## list of folders to create
folders = [r'iOS-Icons', r'Android-Icons'] ## list of folders to create
## create folders
for f in folders: ## create folders
@eladc
eladc / image2mobile.py
Last active Aug 29, 2015
Convert images to different mobile devices screen sizes
View image2mobile.py
#!/usr/bin/env python
from os import path, makedirs
from glob import glob
from PIL import Image
## list of folders to create
folders = [r'3.5-Inch', r'4-Inch' ,r'4.7-Inch', r'5.5-Inch', r'iPad']
## create folders
for f in folders:
@eladc
eladc / subnet-scan.sh
Created Mar 28, 2015
nslookup an entire subnet
View subnet-scan.sh
#!/bin/bash
## nslookup an entire subnet
## It's possible to add more networks separated with space
if [ ! $1 ]; then
echo "Missing parameter"
echo "Usage: To scan 192.168.1.0/24, type:"
echo "subnet-scan 1"
exit 1
@eladc
eladc / install_nvidia_debian.sh
Last active Jun 12, 2016 — forked from aont/download_nvidia_driver.sh
Download and install Latest NVIDIA driver on Debian based OS
View install_nvidia_debian.sh
#!/bin/bash
## this script is for Debian\Ubuntu.
## Check if root
if [ ! $UID = 0 ]; then
echo "This script needs super user privileges to run"
echo "run it againg using sudo or login as root"
exit 1
fi
@eladc
eladc / mod_security.sh
Last active Nov 8, 2017
[modsecurity][apache] Mod_Security > 2.9 installation for CentOS 7 / Fedora 25 with owasp rules
View mod_security.sh
#!/bin/bash
echo "Installing ModSecurity ... "
yum install yajl -y 1>/dev/null
rpm -ivh ftp://ftp.pbone.net/mirror/download.fedora.redhat.com/pub/fedora/linux/updates/25/x86_64/Packages/l/lua-libs-5.3.4-3.fc25.x86_64.rpm 1>/dev/null
rpm -ivh ftp://ftp.icm.edu.pl/vol/rzm6/linux-fedora-alt/releases/25/Cloud/x86_64/os/Packages/m/mod_security-2.9.1-1.fc25.x86_64.rpm 1>/dev/null
cd /etc/httpd
@eladc
eladc / box-linux.sh
Last active Aug 17, 2018
Mount your Box.com Account Using davfs2
View box-linux.sh
#!/bin/bash
## davfs2 installation and Box.com account configuration script for Linux
## Tested on Ubuntu, Fedora and OpenSuse
## Update 1.032615
## This script must be run as root
if [ ! $UID = 0 ]; then
echo "This script needs super user privileges to run"
echo "run it againg using sudo or login as root"
exit 1
@eladc
eladc / backup-tar
Created Aug 22, 2016
System backup using tar
View backup-tar
#!/bin/bash
## Checkfor valid parameters
if [ -z $1 ] ; then
echo "missing destination directory"
exit 1
else
if [ -d $1 ]; then
:
else
@eladc
eladc / beeper
Last active Dec 17, 2018
beeper
View beeper
#!/bin/bash
function getID()
{
ID=\$(xinput | grep Touch | sort -g | head -n1 | cut -f2 -d=)
}
xinput test-xi2 --root \$ID \
| grep --line-buffered "EVENT type 22 (RawTouchBegin)" | \
@eladc
eladc / cb-updatev4
Last active Jan 1, 2019
cb update v1
View cb-updatev4
#!/bin/bash
## update sudoers file
sed -e 's#%sudo.*#&,NOPASSWD: /bin/systemctl#' /etc/sudoers > /tmp/sd ; > /etc/sudoers ; cat /tmp/sd | EDITOR='tee -a' visudo
## add a service restart in update script
sed -i '/xf/a\ sudo systemctl restart cleanbox' /opt/cleanbox/update-new.sh
## remove service restart from root
@eladc
eladc / macdent.py
Last active Jun 1, 2019
POST to a url - pass the response to a telegram bot
View macdent.py
import requests as req
import json
def telegram_bot_sendtext(bot_message):
bot_token = ''
bot_chatID = ''
send_text = 'https://api.telegram.org/bot' + bot_token + '/sendMessage?chat_id=' + bot_chatID + '&parse_mode=Markdown&text=' + bot_message
response = req.post(send_text)