Skip to content

Instantly share code, notes, and snippets.

View iarp's full-sized avatar

Ian R-P iarp

  • Toronto, Ontario, Canada
View GitHub Profile
@iarp
iarp / mw-excel-mwtable.py
Created March 5, 2014 01:25
Convert Excel tables into MediaWiki formatted tables.
import os
# Open pasted-data.txt file, read the contents.
# You could potentially change this to reading the clipboard, and then writing the clipboard with the table.
with open('pasted-data.txt', 'r') as text:
data = text.readlines()
# If the first line is blank, remove it and set blank to True.<br /># If data[0] throws an error, we were passed nothing. Exit.
blank = None
try:
@iarp
iarp / QuoteCommaExport.vb
Last active June 29, 2016 15:56
Proper Excel CSV Export Macro
Sub QuoteCommaExport()
' Dimension all variables.
Dim DestFile As String
Dim FileNum As Integer
Dim ColumnCount As Long
Dim RowCount As Long
' Prompt user for destination file name.
DestFile = InputBox("Enter the destination filename" _
& Chr(10) & "(with complete path):", "Quote-Comma Exporter", "C:\temp\")
@iarp
iarp / php GM Decode
Last active June 10, 2017 12:10
PHP function that decodes GoldMine's log timestamp values
function Decode($strValueIn) {
$intX = 0;
$intY = 0;
$Temp = "";
$Mod = "";
$intMod =0;
$intTemp = 0;
$ValueOut = "";
$intY = 1;
$strValueOut="";
@iarp
iarp / EncDec.py
Last active December 23, 2015 18:29
Simpe rijndael encrypt with decrypt ability.
import base64
import rijndael
KEY_SIZE = 16
BLOCK_SIZE = 32
# I change this value, it needs to be a certain length of 16 or 32 characters in length if i remember correctly.
KEY = 'my custom key'
@iarp
iarp / adminer autologin
Last active January 27, 2022 15:39
A way to allow direct login to adminer
<?php
function adminer_object() {
class AdminerSoftware extends Adminer {
function credentials() {
# You don't need this if statement, but I added it because not having
# it skipped the login screen for everyone.
if ($_GET['username'] == 'username')
return array('127.0.0.1', 'username', 'password');
}
}
@iarp
iarp / gist:6320284
Created August 23, 2013 14:56
Simple encrypt/decrypt functions.
<?php
function decryptRij($text) {
$salt = "my custom key";
return trim(mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $salt, base64_decode($text), MCRYPT_MODE_ECB, mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB), MCRYPT_RAND)));
}
function encryptRij($text) {
$salt = "my custom key";
return trim(base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $salt, $text, MCRYPT_MODE_ECB, mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB), MCRYPT_RAND))));
}