Skip to content

Instantly share code, notes, and snippets.

View virtualadrian's full-sized avatar
🤓
Geek: A knowledgeable and obsessive enthusiast.

VirtualAdrian virtualadrian

🤓
Geek: A knowledgeable and obsessive enthusiast.
View GitHub Profile
@virtualadrian
virtualadrian / README.md
Created June 9, 2019 00:05 — forked from phillipgreenii/README.md
Running NPM Scripts through maven

I am in the process of introducing single page applications to where I work. For development, using node based build tools is much easier for the single page applications. However, the build process for our organization is based upon maven. Our solution started with the maven plugin frontend-maven-plugin. It worked great at first, but then we ran into a situation that I couldn't make work with it.

As stated before, at our organization, we have the older ecosystem which is maven and the newer ecosystem which is node. Our goal was to keep the hacking to a minimum. We did this by putting all of the hacks into a single super node based build file. This is what maven calls and the reason frontend-maven-plugin wasn't sufficient. The super node based build script calls all of the other build scripts by spawning npm run. Try as I might, I could not figure out how to make the spawn work. front-end-maven-plugin downloads npm

var application_root = __dirname,
express = require("express"),
path = require("path"),
mongoose = require('mongoose');
var app = express.createServer();
// database
mongoose.connect('mongodb://localhost/ecomm_database');
@virtualadrian
virtualadrian / google-dorks
Created March 16, 2019 04:17 — forked from stevenswafford/google-dorks
Listing of a number of useful Google dorks.
" _ _ "
" _ /|| . . ||\ _ "
" ( } \||D ' ' ' C||/ { % "
" | /\__,=_[_] ' . . ' [_]_=,__/\ |"
" |_\_ |----| |----| _/_|"
" | |/ | | | | \| |"
" | /_ | | | | _\ |"
It is all fun and games until someone gets hacked!
@virtualadrian
virtualadrian / .appendTo_apache2.conf
Created March 15, 2019 10:28 — forked from shijij/.appendTo_apache2.conf
Apache BasicAuth with MySQL (authn_dbd)
# Append to apache2.conf
# Dont forget to repalce [user] [password] [dbname] with you own info
# ref: https://httpd.apache.org/docs/2.4/mod/mod_dbd.html
# ref: https://httpd.apache.org/docs/2.4/mod/mod_authn_dbd.html
<IfModule mod_authn_dbd.c>
DBDriver mysql
DBDParams host=localhost,port=3306,user=apache,pass=apache,dbname=auth
DBDMin 2
DBDKeep 8
@virtualadrian
virtualadrian / HttpClientAutoConfiguration.java
Created March 8, 2019 17:35 — forked from jkuipers/HttpClientAutoConfiguration.java
Spring Boot auto-configuration example for an Apache Components HTTP client and its usage in all RestTemplates created by the RestTemplateBuilder, plus trace logging support
import org.apache.http.client.HttpClient;
import org.apache.http.client.config.CookieSpecs;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.web.client.RestTemplateCustomizer;
@virtualadrian
virtualadrian / wsh
Created March 8, 2019 13:49 — forked from doctaphred/wsh
If you're going to curl to shell, at *least* verify the checksum!
(
script=$(curl -fsSL <INSERT URL HERE>);
checksum=$(echo "$script" | shasum -pa256 | cut -c-64);
test $checksum = <INSERT CHECKSUM HERE> || exit 1;
sh -c "$script";
)
@virtualadrian
virtualadrian / pagespeed_optimize_images.sh
Created February 16, 2019 20:06 — forked from julianxhokaxhiu/pagespeed_optimize_images.sh
Recursively optimize all PNG and JPG files wherever they are from the script position and inner ( based on OPTING, PNGCRUSH, ADVANCECOMP and JPEGOPTIM )
#!/bin/bash
find . -type f -name "*.png" -o -name "*.PNG" | xargs optipng -nb -nc
find . -type f -name "*.png" -o -name "*.PNG" | xargs advpng -z4
find . -type f -name "*.png" -o -name "*.PNG" | xargs pngcrush -rem gAMA -rem alla -rem cHRM -rem iCCP -rem sRGB -rem time -ow
find . -type f -name "*.jpg" -o -name "*.JPG" | xargs jpegoptim -f --strip-all
@virtualadrian
virtualadrian / config.yml
Created February 15, 2019 22:34 — forked from edheltzel/config.yml
This is my VERY opinionated install script for WordPress - you'll need to have wp-cli installed for this to work - I have this wrapped as an ZSH function inside of my dotfiles setup but you can easily convert to a bash script.
# -------------------------------------------------------------------
# This file live inside of your ~/.wp-cli
# -------------------------------------------------------------------
# path: cms # this is the path to your WordPress files
core install:
admin_user: <YOUR ADMIN USERNAME>
admin_password: <YOUR ADMIN PASSWORD>
admin_email: <YOUR ADMIN EMAIL>
title: The Next Big Deal in WordPress Sites
@virtualadrian
virtualadrian / woocommerce-update-prices.sql
Created February 9, 2019 21:58 — forked from yanknudtskov/woocommerce-update-prices.sql
Queries for updating all prices including variations in WooCommerce In this instance all prices are subtracted 20% (0.8) #woocommerce #mysql
UPDATE wp_postmeta SET meta_value = meta_value*0.8 WHERE meta_key = '_regular_price' AND meta_value != ''
UPDATE wp_postmeta SET meta_value = meta_value*0.8 WHERE meta_key = '_sale_price' AND meta_value != ''
UPDATE wp_postmeta SET meta_value = meta_value*0.8 WHERE meta_key = '_price' AND meta_value != ''
UPDATE wp_postmeta SET meta_value = meta_value*0.8 WHERE meta_key = '_regular_price_tmp' AND meta_value != ''
UPDATE wp_postmeta SET meta_value = meta_value*0.8 WHERE meta_key = '_sale_price_tmp' AND meta_value != ''
UPDATE wp_postmeta SET meta_value = meta_value*0.8 WHERE meta_key = '_price_tmp' AND meta_value != ''
UPDATE wp_postmeta SET meta_value = meta_value*0.8 WHERE meta_key = '_min_variation_price' AND meta_value != ''
UPDATE wp_postmeta SET meta_value = meta_value*0.8 WHERE meta_key = '_max_variation_price' AND meta_value != ''
UPDATE wp_postmeta SET meta_value = meta_value*0.8 WHERE meta_key = '_min_variation_regular_price' AND meta_value != ''
UPDATE wp_postmeta SET meta_value = meta_value*0.8 WHE
@virtualadrian
virtualadrian / update-regular-prices-woocommerce.sql
Created February 9, 2019 21:25 — forked from yanknudtskov/update-regular-prices-woocommerce.sql
Update all Regular Prices, increase by 40% in WooCommerce #woocommerce #mysql
update wp_postmeta set meta_value = meta_value * 1.40 where meta_key='_regular_price'