Skip to content

Instantly share code, notes, and snippets.

View muhfaris's full-sized avatar

Muhammad Faris 'Afif muhfaris

View GitHub Profile
@muhfaris
muhfaris / sftp-ubuntu.md
Created February 27, 2017 03:10 — forked from joshellington/sftp-ubuntu.md
Basic tutorial for creating a SFTP-only user on Ubuntu 9.04 and greater

Adding SFTP-only user to Ubuntu Server

To add a SFTP-only user, you'll need to make sure your SSH config settings are correct, add a new user/group and set permissions for your new user. For step-by-step directions, see below. Omit sudo if you're logged in as root.

Directions

  1. Edit /etc/ssh/sshd_config and make sure to add the following at the end of the file:

     Match group filetransfer
    

ChrootDirectory %h

@muhfaris
muhfaris / nginx.conf
Created February 24, 2017 09:45
Konfigurasi Nginx nginx version: nginx/1.10.3 dan PHP 7.1.2
server {
....
....
location ~ .php$ {
root /usr/share/nginx/html;
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/share/nginx/html$fastcgi_script_name;
@muhfaris
muhfaris / domain.conf
Created February 17, 2017 21:16
CORS - Enable Nginx, pengaturan untuk font, ttf, woff, woff2 dll. dan tidak bisa membuat location root karena sudah ada
server {
listen 80;
server_name www.media.domain.com media.domain.com;
location ~* .(gif|jpg|jpeg|png|wmv|avi|mpg|mpeg|mp4|htm|html|js|css|mp3|swf|ico|flv|woff|woff2|ttf)$ {
expires max;
.................
.................
other configuration
.................
@muhfaris
muhfaris / Source_py.txt
Created January 28, 2017 04:31
Learn More
Learninng Python
1. Python For Beginners | https://staging.python.org/about/gettingstarted/
2. IDOL -Python - Most Recent Stories | http://codeidol.com/community/python/
3. The Definitive Guide to Pylons - James Gardner | http://pylonsbook.com/en/1.0/
4. The Tutorial Python 3 | https://docs.python.org/3/tutorial/index.html
5. Stagging Python | https://staging.python.org/
6. Scraping Python | http://stackoverflow.com/questions/22676/how-do-i-download-a-file-over-http-using-python
Other
@muhfaris
muhfaris / backup.txt
Created January 19, 2017 07:56
backup in bash shell
#!/bin/bash
NOW=$(date +"%Y-%m-%d")
mysqldump -uroot --all-databases > ~/Dropbox/Backup/Database/db_all_$NOW.sql
tar cfz ~/Dropbox/Backup/devwp_$NOW.tar.gz /var/www/devwp.com
tar cfz ~/Dropbox/Backup/devw3_$NOW.tar.gz /var/www/devw3.com
gzip -9 -q -f ~/Dropbox/Backup/Database/db_all_$NOW.sql
#referensi
#https://www.dropbox.com/install-linux
@muhfaris
muhfaris / fail2ban.conf
Last active January 17, 2017 19:54
Melindungi wp-login dari scriptkiddies menggunakan fail2ban
# rules wp-auth.conf
[Definition]
failregex = [[]client <HOST>[]] WP login failed.*
ignoreregex =
# konfig jail.local
[wordpress]
enabled = true
filter = wp-auth
@muhfaris
muhfaris / domain.conf
Created December 31, 2016 09:07
konfigurasi virtual host (subdomain) cdn
server {
listen 80;
server_name www.media.domain.com media.domain.com;
return 301 https://media.domain.com$request_uri;
location ~* .(gif|jpg|jpeg|png|wmv|avi|mpg|mpeg|mp4|htm|html|js|css|mp3|swf|ico|flv)$ {
expires max;
proxy_set_header X-Real-IP $remote_addr;
proxy_pass http://domain.com;
proxy_ignore_headers X-Accel-Expires Expires Cache-Control;
@muhfaris
muhfaris / scrap.py
Created December 9, 2016 01:48
scrape debugger facebook, open url link
import subprocess
import webbrowser
import sys
from socket import error as SocketError
import urllib
import errno
import time
with open('/mnt/Data/temp/test_manual/temp_links_2.txt','r') as infile:
data = infile.read()
listme = data.splitlines()
@muhfaris
muhfaris / other_Mobile.js
Created December 8, 2016 08:28
Update js in mobile share
jQuery(document).ready(function() {
console.log('try it - window ready');
function isMobile(a) {
return (/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea
@muhfaris
muhfaris / Share_frs
Last active December 8, 2016 09:52
Share in Mobile Only
//Js
jQuery(document).ready(function() {
if (jQuery(window).width() < 768) {
jQuery(".share-entry").addClass("active_share");
}else {
jQuery(".share-entry").removeClass("active_share");
}
});
//fungsi php masukkan ke function.php theme nanti