Skip to content

Instantly share code, notes, and snippets.

View protorob's full-sized avatar

protorob

View GitHub Profile
<div class="cf7-custom-style">
<div class="grid-50">
[text* your-name placeholder "Name"]
</div>
<div class="grid-50">
[email* your-email placeholder "Email"]</div>
<div class="grid-100">
[text your-subject placeholder "Subject"]
</div>
<div class="grid-100">
@protorob
protorob / artomultiplo-backups.sh
Created April 12, 2017 08:28
A rude way to create tarballs of your server files and then cancelling it
#!/bin/bash -e
#Giving a name to the file
echo "Name your file (Without .tar.gz - avoid dots and special characters): "
read -e filename
#Making a tar file with the directory excluding snapshot folder
env GZIP=-9 tar cvzf "$filename".tar.gz mywebsite.com/ --exclude="mywebsite.com/wp-content/uploads/snapshots"
#Moving the file to a public directory
<?php
$json = file_get_contents( dirname(__FILE__) . DIRECTORY_SEPARATOR . "prdmd.json");
$jsonToArray = json_decode($json, true);
$productTemplate =
'Title:
{{title}}
----
Identifier:
#!/bin/bash -e
# Start allways the same
wpuser='yourusername'
wpuseremail='yourname@yourdomain.tld'
wpuserpass=$(date +%s | sha256sum | base64 | head -c 10)
dpprefix=$(date +%s | sha256sum | base64 | head -c 6)
clear
@protorob
protorob / processwire_json_page_create.php
Last active April 9, 2018 13:24
Processwire Page Create From Webtic JSON
<?php
$movies = json_decode(file_get_contents('https://secure.webtic.it/frame/wtjsonservices.ashx?wtid=getFullScheduling&localid=1000'));
foreach ($movies->DS->Scheduling->Events as $movie) {
$p = new Page(); // create new page object
$p->template = 'single-movie'; // set template
$p->parent = wire('pages')->get('/programmazione/'); // set the parent
$p->name = $movie->Title; // give it a name used in the url for the page
$p->title = ucfirst($movie->Title); // set page title (not neccessary but recommended)
@protorob
protorob / standardplugs.sh
Last active January 28, 2019 19:14
Standard Plugin Install for WP-CLI
#!/bin/bash -e
# Defining Database Variables:
echo "=================================================================="
echo "We're going to install the standard plugins and Generatepress:"
echo "Plugins to be installed in no particular order:"
echo " - The Seo Framework"
echo " - SiteOrigin Page Builder with Official Extra Widgets and Livemesh ones"
echo " - Widget CSS Classes"
// ==UserScript==
// @name Get div contents and print it to console on OAM course
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match http://www.myatoma.com/Simulatore/*
// @require https://code.jquery.com/jquery-2.2.4.min.js
// ==/UserScript==
import html
just_open = open('art.csv', 'r')
output_file = open('freshnclean.csv', 'w')
i = 0
for row in just_open:
if (i >= 0 and i < 5000):
lariga = html.unescape(row)
@protorob
protorob / findwords.py
Last active May 2, 2019 08:36
Python scrypt for finding pairs of words that behave in curious ways
#inserire il file del vocabolario
words = open("zingarelli.txt", "r")
# cambiare questo valore per stabilire il numero di lettere delle parole (dev'essere un numero % 2 = 0)
maxlenght = 6
wordarray = []
for word in words:
if len(word) == maxlenght + 1:
@protorob
protorob / remove-bg-from-files-in-a-folder.py
Last active May 14, 2019 09:17
A simple Python script to batch remove backgrounds from images in a directory
# This script asumes that you have two directories
# One directory called "origin" with your original images
# Another directory valled "results" that is going to be filled with your processed images :-)
# The name of the directories should be exactly like that "origin" and "results" respectively
# The script also need a remove.bg API key, so you should get one of those
# https://www.remove.bg/api
# it also require "requests" to be installed (see python-requests.org)
import requests
import os