Skip to content

Instantly share code, notes, and snippets.

@Zillionx
Zillionx / pass_gen.py
Created October 3, 2022 18:14
Password generator (Python3)
#!/usr/bin/env python3
import string
import random
## characters to generate password from
characters = list(string.ascii_letters + string.digits + "!@#$%^&*()")
def generate_random_password():
## length of password from the user
// limit post revision (wp-config)
define( 'WP_POST_REVISIONS', 3 );
// disable post revision
define('WP_POST_REVISIONS', false );
// delete revisions MySQL query
DELETE FROM wp_posts WHERE post_type = "revision";
# redirect all users to maintenance page
RewriteCond %{REQUEST_URI} !^/maintenance.php$ [NC]
RewriteRule ^(.*)$ /maintenance.php [R=302,L]
@Zillionx
Zillionx / .htaccess-https-301.conf
Last active September 13, 2019 13:13
.htaccess - HTTPS and www rewrite
RewriteEngine On
## https and www rewrite
# https to www.
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# https (no Cloudflare proxied)
RewriteCond %{HTTP:X-Forwarded-Proto} !https
# Enable and Disable Browser Caching with .htaccess
## Enable Examples
### 1 MONTH for static assets
<filesMatch ".(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$">
Header set Cache-Control "max-age=2592000, public"
</filesMatch>
### 1 DAY for rss feeds and robots
@Zillionx
Zillionx / gist:70256354b254cf263907
Last active September 29, 2018 21:46
Startup Design Framework - How to implement Parallax
// Parallax - paste this code in script.js
$('.content-23.custom-bg').each(function() {
if(! isMobile.any())
$(this).parallax('50%', 0.3, true);
else
$(this).css('background-attachment', 'initial');
});
Bacon ipsum sit amet duis occaecat et corned beef, fugiat pastrami velit magna shoulder ad short ribs in dolore incididunt ribeye. Flank velit short loin ea beef prosciutto, sint jerky ball tip spare ribs. Consectetur pancetta ex, venison frankfurter est qui nulla chuck flank boudin sausage esse magna andouille. Ex frankfurter cow strip steak ground round, incididunt hamburger ad reprehenderit esse.
Ullamco meatball salami, ut tail dolore sunt brisket veniam ex adipisicing. Dolore pariatur short ribs pancetta, exercitation andouille magna eiusmod tempor cillum. Ut bresaola pork belly, velit eiusmod meatloaf tongue chuck reprehenderit shankle. Pariatur frankfurter shankle, leberkas elit pastrami turkey. Irure eiusmod ullamco tenderloin. Esse duis frankfurter excepteur tenderloin ad incididunt pastrami magna dolore jowl, sausage pig ea tempor. Dolore hamburger nostrud cow in.
Prosciutto reprehenderit t-bone commodo ullamco ham. Dolore meatball biltong est esse ribeye, minim exercitation pastrami anim short lo
@Zillionx
Zillionx / htaccess-cache
Last active May 31, 2018 16:32 — forked from Fayozjon/htaccess-cache-config
Enable and Disable Browser Caching with .htaccess
# Enable and Disable Browser Caching with .htaccess
## Enable Examples
### 1 MONTH for static assets
<filesMatch ".(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$">
Header set Cache-Control "max-age=2592000, public"
</filesMatch>
### 1 DAY for rss feeds and robots
@Zillionx
Zillionx / OSX_TCP_options.command
Last active November 21, 2017 03:48
OSX - Tuning the Network Stack TCP
## Quick fix for slow internet after update to OSX 10.11 "El Capitan"
## Changes are not permanent, just restart your mac if it doesn't work.
## write config
sudo su -
sysctl -w net.inet.tcp.doautorcvbuf=0
sysctl -w net.inet.tcp.doautosndbuf=0
sysctl -w net.inet.tcp.win_scale_factor=0
# net.inet.tcp.recvspace=1048576
# net.inet.tcp.sendspace=131072
@Zillionx
Zillionx / OSredir.js
Last active July 3, 2017 09:13
Javascript OS client detection with url redirect
/* Zilli 201507
To detect the operating system on the client machine,
match the value of navigator.appVersion,
then redirect to OS url with the location.replace value.
*/
if (navigator.appVersion.match(/Mac/i)) {
location.replace("index-Mac.html");
}
else if (navigator.appVersion.match(/Win/i)) {