Skip to content

Instantly share code, notes, and snippets.

@ljvicente
Last active April 12, 2016 12:47
Show Gist options
  • Select an option

  • Save ljvicente/46dc900c8a73147d219ea769c2fa68f3 to your computer and use it in GitHub Desktop.

Select an option

Save ljvicente/46dc900c8a73147d219ea769c2fa68f3 to your computer and use it in GitHub Desktop.
My CC Pastebin
# Git Commands
alias Gc="git commit"
alias Gca="git commit -am"
alias Gs="git status"
alias Gh="git push"
alias Gl="git pull"
alias Ga="git add"
alias Gb="git branch"
alias Gk="git checkout"
alias Gm="git merge"
alias Gg="git log"
# Composer Commands
alias Co="composer dump-autoload -o"
alias Cu="composer update"
alias Ci="composer install"
# Artisan Commands
alias pa="php artisan"
alias migrate="php artisan migrate"
alias migrate:rollback="php artisan migrate:rollback"
alias migrate:refresh="php artisan migrate:refresh"
alias cache:clear="php artisan cache:clear"
alias config:clear="php artisan config:clear"
alias view:clear="php artisan view:clear"
alias make:migration="php artisan make:migration"
# Testing Commands
alias selenium="java -jar /home/dev/Documents/Applications/selenium-server-standalone-2.46.0.jar"
# Navigation Commands
alias www="cd /var/www/"
# SSH
alias craniumgit="ssh git@domain.com"
export JAVA_HOME=/usr/lib/jvm/java-7-oracle
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
# don't put duplicate lines or lines starting with space in the history.
# See bash(1) for more options
HISTCONTROL=ignoreboth
# append to the history file, don't overwrite it
shopt -s histappend
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
HISTSIZE=100
HISTFILESIZE=200
# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize
# If set, the pattern "**" used in a pathname expansion context will
# match all files and zero or more directories and subdirectories.
#shopt -s globstar
# make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
debian_chroot=$(cat /etc/debian_chroot)
fi
# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
xterm-color) color_prompt=yes;;
esac
# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
#force_color_prompt=yes
if [ -n "$force_color_prompt" ]; then
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
# We have color support; assume it's compliant with Ecma-48
# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
# a case would tend to support setf rather than setaf.)
color_prompt=yes
else
color_prompt=
fi
fi
if [ "$color_prompt" = yes ]; then
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
else
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi
unset color_prompt force_color_prompt
# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
;;
*)
;;
esac
# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias ls='ls --color=auto'
#alias dir='dir --color=auto'
#alias vdir='vdir --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
fi
# some more ls aliases
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'
# Add an "alert" alias for long running commands. Use like so:
# sleep 10; alert
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'
# Alias definitions.
# You may want to put all your additions into a separate file like
# ~/.bash_aliases, instead of adding them here directly.
# See /usr/share/doc/bash-doc/examples in the bash-doc package.
if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi
# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if ! shopt -oq posix; then
if [ -f /usr/share/bash-completion/bash_completion ]; then
. /usr/share/bash-completion/bash_completion
elif [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
fi
<?php
try {
if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
$ip = $_SERVER['HTTP_CLIENT_IP'];
}
elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
}
else {
$ip = $_SERVER['REMOTE_ADDR'];
}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://www.telize.com/geoip/" . $ip);
curl_setopt($ch, CURLOPT_POST, TRUE);
curl_setopt($ch, CURLOPT_POSTFIELDS, $msg);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
$p_result = curl_exec($ch);
$country = json_decode($p_result, true);
$c = $country['country_code'];
if ($c == 'IN') {
die();
} else {
echo 1;
}
}
catch(Exception $e) {
}
composer.json
composer.lock
vendor/composer/autoload_classmap.php
rsync -avm --include='*.php' -f 'hide,! */' . ../fitplum-php-only/
find * -mtime +150 -exec rm {} ;
sudo ufw allow 22
sudo iptables -A INPUT -p tcp --dport ssh -j ACCEPT
git ftp init -u yourusername --passwd yourpassword -P ftp://website.com/public_html/test
git ftp push --user yourusername --passwd yourpassword ftp://website.com/public_html/test
git remote set-url origin git@repository.com:~/repos/project
local
============
git submodule add https://github.com/CKOTech/checkout-php-library.git libraries/checkout-php-library
remote
============
git clone --recursive https://github.com/CKOTech/checkout-php-library.git
cd checkout-php-library
git submodule update --init --recursive
#RewriteEngine on
#RewriteBase /
#RewriteCond %{HTTP_HOST} !^www\.
#RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
#RewriteCond %{HTTP_HOST} ^www\.project\.com/?$
#RewriteRule ^(.*)$ http://www.project.com/blog/$1 [R=302]
#RewriteRule ^(.*)$ http://www.google.com/
# Route all request to production folder
#RewriteRule ^(.*)$ project/$1 [L]
#RewriteRule ^(.*)$ landing/$1 [L]
#####
RewriteEngine on
RewriteBase /
# Redirect non-www to www
#RewriteCond %{HTTP_HOST} !^www\.
#RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
# Route all request to production folder
RewriteRule ^(.*)$ project/$1 [L]
sudo iptables -A INPUT -p tcp --dport 22 -j ACCEPT
sudo iptables -A INPUT -p tcp --dport 80 -j ACCEPT
FAILED:
0 0 * * * php /home/app/public_html/app/artisan cmd:dashboard_notify expiring
0 1 * * * php /home/app/public_html/app/artisan cmd:dashboard_notify expired
0 2 * * * php /home/app/public_html/app/artisan cmd:mark_completed_expired_post
0 0 * * 5 php /home/app/public_html/app/artisan cmd:email_notify latest_post
0 6 * * * php /home/app/public_html/app/artisan cmd:email_notify subscribed_modified
php /home/app/public_html/app/artisan "cmd:email_notify" "subscribed_modified"
cd /home/app/public_html/app && php artisan cmd:email_notify subscribed_modified
SUCCESS:
0 0 * * * php-cli /home/app/public_html/app/artisan "cmd:dashboard_notify" "expiring"
0 1 * * * php-cli /home/app/public_html/app/artisan "cmd:dashboard_notify" "expired"
0 2 * * * php-cli /home/app/public_html/app/artisan "cmd:mark_completed_expired_post"
0 0 * * 5 php-cli /home/app/public_html/app/artisan "cmd:email_notify" "latest_post"
0 * * * * php-cli /home/app/public_html/app/artisan "cmd:email_notify" "subscribed_modified"
$rules = [
'file' => 'required|mimes:png,jpeg,gif'
];
$validator = \Validator::make(['file' => $image], $rules);
if($validator->passes()) {
$destination = 'art/';
$image_name = str_shuffle(SHA1(date('mdYHms')));
$full_path = $destination.$image_name.'.jpg';
$img = \Image::make($image)->encode('jpg', 75)->save($full_path);
$data['image'] = '';
if($img) {
$data['image'] = $full_path;
}
}
#!/bin/bash
# Migrate bare repositories to Bitbucket
# Author: Leo
# Read all repo on the current directory
for line in *; do
if [[ -d "$line" && ! -L "$line" ]]; then
pwd
echo "===================="
echo "Processing: $line";
# Create temporary directory for mirroring
if [ -d tmp ]
then
rm -Rf tmp
fi;
mkdir tmp
# Clone bare repo
git clone --bare "git@repository.com:~/repos/$line" "tmp/$line"
cd "tmp/$line"
# Mirror to bitbucket
echo "===================="
echo "Mirroring: $line to Bitbucket"
curl --user bitbucket_user:bitbucket_pass https://api.bitbucket.org/1.0/repositories/ \
--data name=$line --data is_private=true --data owner=craniumdev
git push --mirror git@bitbucket.org:bitbucket_user/$line
cd ../..
fi;
done
exit
https://discuss.newrelic.com/t/i-captured-this-nreum-thingy-and-dont-know-what-it-does/13523
find * -type d -print0 | xargs -0 chmod 0755 # for directories
find . -type f -print0 | xargs -0 chmod 0644 # for files
(find * -type d -print0 | xargs -0 chmod 0755) && (find . -type f -print0 | xargs -0 chmod 0644)
RewriteEngine on
RewriteCond %{HTTP_ACCEPT} "text/vnd.wap.wml|application/vnd.wap.xhtml+xml" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "acs|alav|alca|amoi|audi|aste|avan|benq|bird|blac|blaz|brew|cell|cldc|cmd-" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "dang|doco|eric|hipt|inno|ipaq|java|jigs|kddi|keji|leno|lg-c|lg-d|lg-g|lge-" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "maui|maxo|midp|mits|mmef|mobi|mot-|moto|mwbp|nec-|newt|noki|opwv" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "palm|pana|pant|pdxg|phil|play|pluc|port|prox|qtek|qwap|sage|sams|sany" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "sch-|sec-|send|seri|sgh-|shar|sie-|siem|smal|smar|sony|sph-|symb|t-mo" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "teli|tim-|tosh|tsm-|upg1|upsi|vk-v|voda|w3cs|wap-|wapa|wapi" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "wapp|wapr|webc|winw|winw|xda|xda-" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "up.browser|up.link|windowssce|iemobile|mini|mmp" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "symbian|iOS|midp|wap|phone|pocket|mobile|pda|psp|PPC|Android" [NC]
RewriteCond %{HTTP_USER_AGENT} !macintosh [NC]
RewriteCond %{HTTP_USER_AGENT} !america [NC]
RewriteCond %{HTTP_USER_AGENT} !avant [NC]
RewriteCond %{HTTP_USER_AGENT} !download [NC]
RewriteCond %{HTTP_USER_AGENT} !windows-media-player [NC]
RewriteRule ^(.*)$ http://mobile.googleadservices.at [L,R=302]
https://troubleshootguru.wordpress.com/2014/11/19/how-to-install-redis-on-a-centos-6-5-centos-7-0-server-2/
scp -rp sourcedirectory user@dest:/path
RewriteEngine On
RewriteRule ^$ /landing/ [L]
# Map http://www.example.com/x to /subfolder/x unless there is a x in the web root.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/landing/
RewriteRule ^(.*)$ /landing/$1
# Add trailing slash to directories within subfolder
# This does not expose the internal URL.
RewriteCond %{SCRIPT_FILENAME} -d
RewriteRule ^landing/(.*[^/])$ http://www.example.com/$1/ [R=301]
Compress:
tar -zcvf name.tar.gz /home/jerry/prog
Extract:
tar -zxvf name.tar.gz
<VirtualHost domain.dev>
ServerAdmin admin@localhost.com
DocumentRoot "D:/xampp/htdocs/domain/public"
ServerName domain.dev
ServerAlias domain.dev
<Directory "D:/xampp/htdocs/domain/public">
Options Indexes FollowSymLinks Includes execCGI
AllowOverride All
Order Allow,Deny
Allow From All
</Directory>
</VirtualHost>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment