Skip to content

Instantly share code, notes, and snippets.

@pixelpylon
pixelpylon / bokun signature
Created February 23, 2021 21:09
postman pre-script to obtain bokun signature
const moment = require('moment');
let timestamp = moment().utc().format("YYYY-MM-DD HH:mm:ss");
pm.globals.set("timestamp", timestamp);
const access = "ACCESS_KEY";
let csting = timestamp+access+"GET"+pm.request.url.getPathWithQuery();
const secret = "SECRET_KEY";
const hmac = CryptoJS.HmacSHA1(csting, secret);
const signature = hmac.toString(CryptoJS.enc.Base64);
pm.globals.set("signature", signature);
find /mnt/g/imgtest/ -not -path "*/static/*" \( -name '*.png' -o -name '*.jpg' -o -name '*.jpeg' \) -print0 | xargs -0 -P8 -n2 mogrify -strip -thumbnail '1920>'
find -size +1M
#!/usr/bin/env bash
APACHE_USER=wwwhost
VHOSTS_DOMAINS=(example.com second.example.com)
sudo ufw allow in "OpenSSH"
# Install Apache
sudo apt-get update
sudo apt-get install apache2
sudo nano /etc/apache2/apache2.conf # Add ServerName ... directive at bottom
BEGIN
DECLARE startingRange INT DEFAULT 1;
WHILE startingRange <= 100 DO
SET FOREIGN_KEY_CHECKS=0;
INSERT INTO `user_tour_qualification` (`id`, `user_id`, `tour_qualification_id`, `created_at`, `updated_at`) VALUES (startingRange, startingRange, '9', '2020-08-18 00:00:00', '2020-08-18 00:00:00');
SET startingRange = startingRange + 1;
SET FOREIGN_KEY_CHECKS=1;
END WHILE;
END
@pixelpylon
pixelpylon / apachesite.conf
Last active March 6, 2020 16:30
config file for wp site on apache
<VirtualHost 127.0.0.28>
ServerName wp
ServerAdmin webmaster@localhost
DocumentRoot /mnt/g/wp
<Directory /mnt/g/wp/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
@pixelpylon
pixelpylon / wp-list-all-permalinks.php
Last active December 27, 2019 11:55
wp-list-all-permalinks.php
@pixelpylon
pixelpylon / .htaccess
Last active August 28, 2019 02:44
sample .htaccess file for wp project with redirect to www and https
Options -Indexes
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
# www
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# https
RewriteCond %{HTTP:X-Forwarded-Proto} !https
<div class="parent">
<h4 class="ribbon">Skip The Line<br> <small>not available elsewhere</small></h4>
</div>
<style>
@import url('https://fonts.googleapis.com/css?family=Rubik&display=swap');
.parent {
overflow: hidden;
width: 100%;
height: 300px;
@pixelpylon
pixelpylon / wp_replace_sql
Created May 26, 2019 02:38
wp db migration sql
UPDATE wp_options SET option_value = replace(option_value, 'http://old', 'http://new') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET post_content = replace(post_content, 'http://old', 'http://new');
UPDATE wp_postmeta SET meta_value = replace(meta_value,'http://old','http://new');
UPDATE wp_usermeta SET meta_value = replace(meta_value, 'http://old','http://new');
UPDATE wp_links SET link_url = replace(link_url, 'http://old','http://new');