Skip to content

Instantly share code, notes, and snippets.

View PH4NTOMiki's full-sized avatar
💭
Programming

Mihael Mutić PH4NTOMiki

💭
Programming
View GitHub Profile
@PH4NTOMiki
PH4NTOMiki / delete-index-html-and-empty-directories.js
Last active January 21, 2020 11:48
Recursively delete index.html files and empty directories
const fs = require('fs');
const path = require('path');
function cleanEmptyFoldersRecursively(folder) {
var isDir = fs.statSync(folder).isDirectory();
if (!isDir) {
return;
}
var files = fs.readdirSync(folder);
if (files.length > 0) {
@PH4NTOMiki
PH4NTOMiki / embedded-file-viewer.md
Created December 12, 2020 20:41 — forked from tzmartin/embedded-file-viewer.md
Embedded File Viewer: Google Drive, OneDrive

Office Web Apps Viewer

('.ppt' '.pptx' '.doc', '.docx', '.xls', '.xlsx')

http://view.officeapps.live.com/op/view.aspx?src=[OFFICE_FILE_URL]

<iframe src='https://view.officeapps.live.com/op/embed.aspx?src=[OFFICE_FILE_URL]' width='px' height='px' frameborder='0'>
</iframe>

OneDrive Embed Links

<!DOCTYPE html>
<html>
<!--
Copyright 2011 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
@PH4NTOMiki
PH4NTOMiki / index.js
Last active June 20, 2021 15:43 — forked from mehulmpt/index.js
Slow Loris attack using Node
const net = require('net');
const opts = {
host: 'localhost',
port: 80,
//sockets: 8000,
sockets: 1000,
respawn: true,
//rate: 600,
rate: 5e3,
@PH4NTOMiki
PH4NTOMiki / gist:8a563aaf4e65bc42d2a81f41c3716a79
Created June 28, 2021 14:59 — forked from moneal/gist:9859180
Disable WordPress script concatenation.
/**
* Disable script concatenation.
* If WordPress's dashboard isn't loading styles from load-styles.php
* add this to wp-config.php to disable concatenation and load styles that
* don't have errors
*/
define( 'CONCATENATE_SCRIPTS', false );
@PH4NTOMiki
PH4NTOMiki / wc-free-checkout-fields.php
Created July 17, 2021 16:47 — forked from bekarice/wc-free-checkout-fields.php
Simplify WooCommerce checkout fields for free checkouts
<?php // only copy if needed
/**
* Removes coupon form, order notes, and several billing fields if the checkout doesn't require payment.
*
* REQUIRES PHP 5.3+
*
* Tutorial: http://skyver.ge/c
*/
function sv_free_checkout_fields() {
@PH4NTOMiki
PH4NTOMiki / _vultr-snapshot.md
Created July 26, 2021 18:00 — forked from Rhilip/_vultr-snapshot.md
Automatic snapshots using Vultr API (Python3)

Thanks to Automated Snapshots / Backups via Vultr API And this is Python3 version script used to Automatic snapshots using Vultr API


A more customizable alternative to Vultr's backup feature using Vultr API v1. Tested on Ubuntu 16.04. Run this python3 script on Anywhere to create a snapshot of VPS (which you know IP or it's subid) and rotate out the oldest snapshot(s). Use the BACKUP_TAG_PREFIX prefix field to uniquely id a set of snapshots.

Notice: You can only create 11 snapshots by default.


@PH4NTOMiki
PH4NTOMiki / wp-ajax-loadmore.md
Created August 21, 2021 18:14 — forked from aslamdoctor/wp-ajax-loadmore.md
Wordpress - AJAX Load More Steps

Step 1. Load more button

<?php
global $wp_query; // you can remove this line if everything works for you
 
// don't display the button if there are not enough posts
if (  $wp_query->max_num_pages > 1 )
	echo '<div class="misha_loadmore">More posts</div>'; // you can use <a> as well
?>
@PH4NTOMiki
PH4NTOMiki / index.html
Created October 1, 2021 16:24 — forked from maxkostinevich/index.html
Cloudflare Worker - Handle Contact Form
<!--
/*
* Serverless contact form handler for Cloudflare Workers.
* Emails are sent via Mailgun.
*
* Learn more at https://maxkostinevich.com/blog/serverless-contact-form
* Live demo: https://codesandbox.io/s/serverless-contact-form-example-x0neb
*
* (c) Max Kostinevich / https://maxkostinevich.com
*/
@PH4NTOMiki
PH4NTOMiki / hjhjkhjk
Created November 15, 2021 12:59
Created from Remix Form!
bhjgbhhjgh