Skip to content

Instantly share code, notes, and snippets.

View h3nr1ke's full-sized avatar
🤔
Should I?

H3NR1KE h3nr1ke

🤔
Should I?
View GitHub Profile
@h3nr1ke
h3nr1ke / compress_command_line.sh
Created February 15, 2018 17:32
Install and use compress tool ubuntu
#install
sudo apt-get install yui-compressor
#to use, js and css files only
yui-compressor /path/to/file -o /path/to/new/file
@h3nr1ke
h3nr1ke / certbot.sh
Last active March 26, 2018 22:17
certbot error...
#---- renew ssl when you get the error
#---- Client with the currently selected authenticator does not support any combination of challenges that will satisfy the CA.
certbot --authenticator standalone --installer apache -d <domain> --pre-hook "systemctl stop apache2" --post-hook "systemctl start apache2"
@h3nr1ke
h3nr1ke / useful-ubuntu-server.sh
Last active April 2, 2018 18:44
maintenance commands ubuntu server
#restart nginx
service nginx restart
#restart php
service php7.0-fpm restart
#list all services running
service --status-all
#add path
@h3nr1ke
h3nr1ke / UsefulGitCommands.txt
Last active April 3, 2018 15:06
Useful git tips
#--- good resource
http://gitready.com/
#--- When you want to commit files that used to be ignored or vice versa
git rm -r --cached .
git add .
git commit -m "Commit follows the .gitignore again"
#--- Get the remote URL from a repository
git config --get remote.origin.url
@h3nr1ke
h3nr1ke / usefulwordpress.php
Last active April 6, 2018 18:12
Useful Wordpress code
<?php
//==================================
// ONLY ONE ITEM IN THE CART AT TIME
//==================================
add_filter( 'woocommerce_add_cart_item_data', 'woo_custom_add_to_cart' );
function woo_custom_add_to_cart( $cart_item_data ) {
global $woocommerce;
// REMOVE ALL OTHER ITEMS
$woocommerce->cart->empty_cart();
@h3nr1ke
h3nr1ke / nginx_tips.txt
Created May 2, 2018 00:48
Useful tips for nginx configuration
# -- UBUNTU + PHP7 + NGINX
# -- must add it to you pgp location
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock; #replace if already there...
# -- must to check the listen path to php fpm sock is this file
nano /etc/php/7.0/fpm/pool.d/www.conf
# -- search for "listen = ", this path must be
/var/run/php/php7.0-fpm.sock
@h3nr1ke
h3nr1ke / PPK2PEM.sh
Created May 23, 2018 02:57
Convert ppk to pem
# mac
brew install putty
#linux
apt-get install putty-tools
puttygen keybase.ppk -O private-openssh -o output.pem
#connect
ssh -i output.pem user@your.server.com
@h3nr1ke
h3nr1ke / colored_bash.profile
Last active May 23, 2018 22:02
Lines to let your terminal on max os use theme colors all the time
#add this content to your .bash_profile file
export PS1="\[\033[36m\]\u\[\033[m\]@\[\033[32m\]\h:\[\033[33;1m\]\w\[\033[m\]\$ "
export CLICOLOR=1
export LSCOLORS=ExFxBxDxCxegedabagacad
alias ls='ls -GFh'
#create a new file called darkside.terminal and add the following content
<?xml version="1.0" encoding="UTF-8"?>
@h3nr1ke
h3nr1ke / android_home.sh
Created May 29, 2018 17:09
Add android_home variable
#add this code to your .bash_profile
#------
export ANDROID_SDK_ROOT='/Users/<YOURUSER>/Library/Android/sdk'
export PATH=$PATH:$ANDROID_SDK_ROOT/tools:$ANDROID_SDK_ROOT/platform-tools:$ANDROID_SDK_ROOT/tools/lib/x86_644
#------
@h3nr1ke
h3nr1ke / add_swap_ubuntu.sh
Created July 7, 2018 01:07
Add a swap memory partition to your ubuntu 16.04 server
#!/bin/bash
#-- create the swap
sudo fallocate -l 1G /swapfile
#-- change permission
sudo chmod 600 /swapfile
#-- do the swap
sudo mkswap /swapfile