Skip to content

Instantly share code, notes, and snippets.

@Zillionx
Zillionx / pass_gen.py
Created October 3, 2022 18:14
Password generator (Python3)
View pass_gen.py
#!/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
View Set wordpress post revisions.php
// 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";
View .htaccess-maintenance.conf
# 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
View .htaccess-https-301.conf
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
View .htaccess-cache
# 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
View Bacon Ipsum.txt
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
View htaccess-cache
# 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 / pets.top
Created March 7, 2017 02:32
ChatScript topic example
View pets.top
topic: ~pets (dog cat pet animal bird fish snake)
?: ( << you like snake >>)
I love pythons except ^"Python" (the programming language)
?: ( << you ~like ~animals >>)
I love all animals.
t: Do you have any pets?
@Zillionx
Zillionx / Select_ShowDiv.html
Last active December 2, 2015 21:19
Show Div when selectedIndex Property != 0
View Select_ShowDiv.html
<!doctype html>
<!-- http://www.w3schools.com/jsref/prop_select_selectedindex.asp -->
<html>
<head>
<meta charset="UTF-8">
<title>tst</title>
<script type="text/javascript">
function ShowDiv() {
if (document.getElementById('Country').selectedIndex != 0 ) {
document.getElementById('Show').style.display = 'block';
@Zillionx
Zillionx / Shrink_OSX_VirtualDisk.sh
Last active May 22, 2016 07:24
Shrinking virtual disks on OSX VMWare fusion via CLI
View Shrink_OSX_VirtualDisk.sh
#!/bin/sh
# remove vm snapshots
# change your path /path_to_your/disc.vmdk
#
# source: http://snipurl.com/maggini_vmdisc_osx
cd '/Applications/VMware Fusion.app/Contents/Library'
# defrag
./vmware-vdiskmanager -d path_to_your/disc.vmdk