Skip to content

Instantly share code, notes, and snippets.

@paxperscientiam
paxperscientiam / createthumb.phps
Last active April 8, 2016 03:43
experimental addition to claviska/SimpleImage
<?PHP
// Disclaimer: USE AT YOUR OWN PERIL
//Script for generating 'thumbs' for SimpleImage.
namespace abeautifulsite;
use Exception;
//test for the environment ... CLI versus browser
if (PHP_SAPI === 'cli') {
$reldir = $argv[1];
@paxperscientiam
paxperscientiam / macycle
Last active July 5, 2016 02:21
Simple script for MAC address spoofing for Bash on OSX
#!/opt/local/bin/bash
# NEWS (4/7/16) Working.
# This is an active experiment; use at your own peril!
# Comments and criticism are most welcome!
# Motivation, to get devices without captive portal support online.
#
#
# environment stuff
unset CDPATH
;; xr - convert string regexp to rx notation
(require 'rx)
(defun xr-parse-char-alt ()
(let ((set nil))
(when (looking-at "]")
(forward-char 1)
(setq set (list "]")))
(while (not (looking-at "]"))
@paxperscientiam
paxperscientiam / php-includes-ov.el
Last active July 8, 2016 12:36
php include show
;;; active experiment -- YOU USE THIS CODE AT YOUR OWN PERIL
;;; comments and criticisms welcome
;; dependencies: ShingoFukuyama/ov.el
;; credits: offby1 & ijp @ freenode/#emacs
;;
;;
;;; set variables
(setq captureFileRegExp "^<\\?php\s+include\s+[\"\']\\([\/a-z0-9]+\.[a-z]+\\)[\"\']\;\/\/ov\s+\\?>\n$")
;;
;;
@paxperscientiam
paxperscientiam / example
Created September 15, 2016 18:47
Exporting UTF-8 WS Data with VBA
I've posted this on Microsoft Answers and Reddit already, but, for posterity, I'm putting it on Pastebin too.
Refer to this paste: http://pastebin.com/US1wuKgH
Or, to the StackOverflow post by Robert Knight if it still exists: https://stackoverflow.com/questions/6136798/vba-shell-function-in-office-2011-for-mac
Basically, you feed execShell() a script that copies the data from a worksheet and passes it from the clipboard into a newly formed file. The trick, though, is to set the "locale" of the newly spawned shell session.
Example VBA code:
***
rngSomeRange.copy
@paxperscientiam
paxperscientiam / getroundinteger.bas
Created September 15, 2016 18:48
VBA nearest integer
Function getRoundInteger(num As Double) As Double
Const BUG As Boolean = 1
Dim er As Integer: er = 0
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' getRoundInteger( ) v.1.0
' Function getRoundInteger( ) takes a double and uses the "rounds half up" method (towards +∞) to get the nearest "integer".
' The error stuff was just an experiment that will get it's on follow up.
' Works pretty well, though use at your own discretion!
' ~ Pax Per Scientiam
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
@paxperscientiam
paxperscientiam / execShell.bas
Created September 15, 2016 18:59
execShell VBA module by Robert Knight
' This User Defined Function was written by Robert Knight of StackOverflow
' Designed for Excel 2011, though it might work in the Windoze version too.
' It is shared here for posterity.
Private Declare Function popen Lib "libc.dylib" (ByVal command As String, ByVal mode As String) As Long
Private Declare Function pclose Lib "libc.dylib" (ByVal file As Long) As Long
Private Declare Function fread Lib "libc.dylib" (ByVal outStr As String, ByVal size As Long, ByVal items As Long, ByVal stream As Long) As Long
Private Declare Function feof Lib "libc.dylib" (ByVal file As Long) As Long
@paxperscientiam
paxperscientiam / archive
Created October 18, 2016 15:38
Archive web projects
#!/opt/local/bin/bash
# you should be sure to alter the above path to match the bash you want to use.
# adjust source and target to match your needs.
# adjust exclusions to match your needs.
# recommendation: use in conjunction with cron.
#
# As part of a multipronged strategy, I use rsync for archiving my work on Dropbox.
# As always, use this code at your own peril.
# sass-lint config generated by make-sass-lint-config v0.1.2
#
# The following scss-lint Linters are not yet supported by sass-lint:
# DisableLinterReason, ElsePlacement, PropertyCount, SelectorDepth
# SpaceAroundOperator, TrailingWhitespace, UnnecessaryParentReference, Compass::*
#
# The following settings/values are unsupported by sass-lint:
# Linter Indentation, option "allow_non_nested_indentation"
# Linter Indentation, option "character"
# Linter NestingDepth, option "ignore_parent_selectors"
@paxperscientiam
paxperscientiam / gist:3512d3f827ae340bb5383b2422b62fd8
Created November 10, 2016 03:51 — forked from plasticbrain/gist:3887245
PHP: mime types (array format)
<?php
$mime_types = array(
'.3dm' => 'x-world/x-3dmf',
'.3dmf' => 'x-world/x-3dmf',
'.a' => 'application/octet-stream',
'.aab' => 'application/x-authorware-bin',
'.aam' => 'application/x-authorware-map',
'.aas' => 'application/x-authorware-seg',
'.abc' => 'text/vnd.abc',
'.acgi' => 'text/html',