Skip to content

Instantly share code, notes, and snippets.

<?php
$dir = '/var/www/html/';
$files1 = scandir($dir);
print_r($files1);
?>
@adamstraube
adamstraube / GeoblockCountries.js
Last active March 15, 2022 02:01
Geoblocking by country code for use in Auth0 Actions
/**
* Geoblock users by Country code
*
* The action below blocks the following countries:
* - Russia
* - Belarus
* - Iran
* - Cuba
* - Syria
* - North Korea
@adamstraube
adamstraube / rungit.sh
Last active December 14, 2022 12:41
Bash shell wrapper for running git-runner locally within WSL on a Windows 10 machine using Docker Desktop.
#!/usr/bin/env bash
if [[ $# -eq 0 ]]
then
echo "Usage: {up|down|runStages}"
exit 0
fi
PWD_RESOLVED="$(pwd -P)"
@adamstraube
adamstraube / remove-dir-path.sh
Created October 17, 2019 01:52
Remove directory path from filename - SED
#!/bin/bash
# Full filenames+dirs, 1 per per line in filenames.txt first
sed -i "s:.*\/::" filenames.txt
==================================
node -v ; npm -v ; yarn -v
==================================
v10.8.0
6.2.0
bash: yarn: command not found
==================================
hyperd run -t test /bin/sh
@adamstraube
adamstraube / jquery-3.1.0.min.js
Created October 18, 2016 04:58
VivaGraphJS - Chrome extension bug
/*! jQuery v3.1.0 | (c) jQuery Foundation | jquery.org/license */
!function(a,b){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){"use strict";var c=[],d=a.document,e=Object.getPrototypeOf,f=c.slice,g=c.concat,h=c.push,i=c.indexOf,j={},k=j.toString,l=j.hasOwnProperty,m=l.toString,n=m.call(Object),o={};function p(a,b){b=b||d;var c=b.createElement("script");c.text=a,b.head.appendChild(c).parentNode.removeChild(c)}var q="3.1.0",r=function(a,b){return new r.fn.init(a,b)},s=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,t=/^-ms-/,u=/-([a-z])/g,v=function(a,b){return b.toUpperCase()};r.fn=r.prototype={jquery:q,constructor:r,length:0,toArray:function(){return f.call(this)},get:function(a){return null!=a?a<0?this[a+this.length]:this[a]:f.call(this)},pushStack:function(a){var b=r.merge(this.constructor(),a);return b.p
@adamstraube
adamstraube / JS-JQuery-Toolbox.js
Created February 19, 2016 01:27
Quick JS/JQuery Toolbox
// Find all items with "required" class in the form with "form-horizontal" class
$(".form-horizontal .required").each(function(i,e){console.log(i+' '+e)});
@adamstraube
adamstraube / docker_vpn.sh
Last active August 29, 2015 14:21
Install Docker and a docker based VPN - Written originally for use on VPS's (Requires 3.10 Kernel at least)
#Get Docker
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9
echo "deb http://get.docker.io/ubuntu docker main" > /etc/apt/sources.list.d/docker.list
aptitude update
apt-get install lxc-docker
#Get virtual network software
apt-get install vde2
#Create new interfaces
vde_switch -tap tap0
#Assign new interface IP
@adamstraube
adamstraube / JQuery.validator.js
Created March 16, 2015 04:09
Detect Unicode Chars in JS regex
jQuery.validator.addMethod("alphanumeric", function(value, element) {
return this.optional(element) || /[!^\x00-\x80]+/i.test(value);
}, "Letters, numbers, and underscores only please");
@adamstraube
adamstraube / Trimester-field-Deakin-Uni.groovy
Last active August 29, 2015 14:16
Scripted JIRA groovy field - Trimester number and year based on date created
import com.atlassian.core.util.DateUtils
import com.atlassian.jira.ComponentManager
import org.joda.time.DateTime
import org.joda.time.DateMidnight
import org.joda.time.LocalDate
import org.joda.time.format.*
timestamp = issue.getCreated()
DateTimeFormatter formatter = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss.S")