Skip to content

Instantly share code, notes, and snippets.

View FeroVolar's full-sized avatar
✌️

Fero Volar FeroVolar

✌️
View GitHub Profile
@FeroVolar
FeroVolar / .bashrc
Last active October 5, 2015 06:08
color prompt
# add to ~/.bashrc
if ${use_color} ; then
# Enable colors for ls, etc. Prefer ~/.dir_colors #64489
if type -P dircolors >/dev/null ; then
if [[ -f ~/.dir_colors ]] ; then
eval $(dircolors -b ~/.dir_colors)
elif [[ -f /etc/DIR_COLORS ]] ; then
eval $(dircolors -b /etc/DIR_COLORS)
fi
@FeroVolar
FeroVolar / ping.php
Last active December 10, 2015 19:48
PHP ping
<?php
$output = shell_exec('/bin/ping -c 5 127.0.0.1');
echo "<pre>$output</pre>";
?>
@FeroVolar
FeroVolar / icecast
Last active December 10, 2015 19:48
IceCast StartStop script
#!/bin/sh
#
# icecast This shell script takes care of starting and stopping
# the icecast multimedia streaming systen.
#
# config: /etc/icecast/icecast.xml
# Source function library.
. /etc/rc.d/init.d/functions
@FeroVolar
FeroVolar / redmine
Created December 11, 2013 14:32
Redmine init.d script for Debian
#!/bin/bash
### BEGIN INIT INFO
# Provides: redmine
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: redmine webrick
# Description: redmine webrick server autostart-script
### END INIT INFO
@FeroVolar
FeroVolar / banner.sh
Last active January 2, 2016 08:18
shell banner
banner -w25 "Hello, World"
@FeroVolar
FeroVolar / permissions.sh
Last active January 2, 2016 14:19
Learn octal file permissions easily with stat
$ stat -c "%a %A %n" /usr/sbin/* | head
755 -rwxr-xr-x /usr/sbin/aa-status
777 lrwxrwxrwx /usr/sbin/accept
755 -rwxr-xr-x /usr/sbin/accessdb
755 -rwxr-xr-x /usr/sbin/acpid
777 lrwxrwxrwx /usr/sbin/addgroup
755 -rwxr-xr-x /usr/sbin/add-shell
755 -rwxr-xr-x /usr/sbin/adduser
755 -rwxr-xr-x /usr/sbin/anacron
755 -rwxr-xr-x /usr/sbin/apachetop
@FeroVolar
FeroVolar / twofinger.sh
Created March 12, 2014 14:21
How to enable Two finger scrolling on Lenovo
#!/bin/bash
xinput --set-prop --type=int --format=32 "SynPS/2 Synaptics TouchPad" "Synaptics Two-Finger Pressure" 4
xinput --set-prop --type=int --format=32 "SynPS/2 Synaptics TouchPad" "Synaptics Two-Finger Width" 8
xinput --set-prop --type=int --format=8 "SynPS/2 Synaptics TouchPad" "Synaptics Two-Finger Scrolling" 1 0
@FeroVolar
FeroVolar / remote.sh
Last active August 29, 2015 14:16
Remote shell commands execution
## ssh remoteserver.com 'bash -s' < commands.sh
#
## commands.sh example
sudo su
cd /web/remoteserver.com/
git remote update
LOCAL=$(git rev-parse @)
REMOTE=$(git rev-parse @{u})
@FeroVolar
FeroVolar / sms.php
Last active August 29, 2015 14:26
Sending SMS
<?php
function send_sms($mobile,$msg)
{
$authKey = "XXXXXXXXXXX";
date_default_timezone_set("Asia/Kolkata");
$date = strftime("%Y-%m-%d %H:%M:%S");
//Multiple mobiles numbers separated by comma
$mobileNumber = $mobile;
//Sender ID,While using route4 sender id should be 6 characters long.
@FeroVolar
FeroVolar / mandrillmail.php
Last active August 29, 2015 14:26
SENDING EMAIL WITH MANDRILL
<?php
function send_email($to_email,$subject,$message1)
{
require_once 'Mandrill.php';
$apikey = 'XXXXXXXXXX'; //specify your api key here
$mandrill = new Mandrill($apikey);
$message = new stdClass();
$message->html = $message1;
$message->text = $message1;