Skip to content

Instantly share code, notes, and snippets.

View dfrankland's full-sized avatar
🏕️
Catching Pokemon

Dylan Frankland dfrankland

🏕️
Catching Pokemon
View GitHub Profile
@dfrankland
dfrankland / file_rename.py
Created December 24, 2014 19:55
Font Rename Files
import os
import shutil
import re
def changeFileName(files):
for file in files:
name = file.split("-")
extension = name[2].split(".")[1]
newFileName = ".".join([name[1],extension])
os.renames(file, newFileName)
@dfrankland
dfrankland / geocode-address-crossdomain.js
Last active August 29, 2015 14:13
Geocode Addresses Cross Domain using Google Maps API
var jquery = document.createElement('script');
jquery.src = "https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js";
document.getElementsByTagName('head')[0].appendChild(jquery);
document.addEventListener("DOMContentLoaded", function(event) {
sheet = "title^is_active^phone^country_id^region^street^city^postal_code^desc^latitude^longitude^stores^website^icon^image^position\n";
$('.magasin').each(function(){
/*Dealer Name*/
$(this).children('.nom_mag').children('font').remove();
title = $(this).children('.nom_mag').text();
<svg preserveAspectRatio="xMinYMin" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
viewBox="0 0 560 1388">
<defs>
<mask id="canTopMask">
<image width="560" height="1388" xlink:href="img/can-top-alpha.png"></image>
</mask>
</defs>
<image mask="url(#canTopMask)" id="canTop" width="560" height="1388" xlink:href="can-top.jpg"></image>
</svg>
@dfrankland
dfrankland / greenButton.html
Last active August 29, 2015 14:14
Green button for a website. http://jsfiddle.net/3jcqtyhb/1/
<html>
<head>
<style>
.greenButton {
-moz-box-shadow:inset 0px 0px 2px 2px #b4dd8e;
-webkit-box-shadow:inset 0px 0px 2px 2px #b4dd8e;
box-shadow:inset 0px 0px 2px 2px #b4dd8e;
background-color:#8ec748;
-moz-border-radius:4px;
-webkit-border-radius:4px;
@dfrankland
dfrankland / odoo-server.conf
Last active January 28, 2018 14:40
Upstart script for OpenERP/Odoo on Ubuntu 14.04 (Should be placed in /etc/init/)
#!upstart
description "odoo-server"
start on runlevel [2345]
stop on runlevel [!2345]
#Respawn, with a limit of 10 times in a timespan of 90 seconds, after which it stops respawning.
respawn
respawn limit 10 90
@dfrankland
dfrankland / account_invoice_webkit.mako
Last active August 29, 2015 14:21
Some Mako Webkit Reports for OpenERP....
## -*- coding: utf-8 -*-
%for inv in objects :
<%def carriage_returns(text):
return text.replace('\n', '<br />')
%>
<% setLang(inv.partner_id.lang) %>
<html>
<head>
<style type="text/css">
${css}
@dfrankland
dfrankland / check-if-ip-changed.sh
Last active August 29, 2015 14:21
Check for changes in WAN ip using http://ifconfig.me
#!/bin/bash
ip1="";
ip2="";
changed=0;
date1=$( date "+%s" )
while true; do
ip1=$(curl -s ifconfig.me/ip);
if [[ "$ip1" != "$ip2" ]]; then
changed=$(( changed + 1 ));
date2=$( date "+%s" )
@dfrankland
dfrankland / admin_add_product_example.php
Created June 4, 2015 00:19
Examples of how to use Magento OAuth that actually work!
<?php
$callbackUrl = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']; // This scripts url
$magentoUrl = 'http://example.com/'; // The url of your magento installation
$temporaryCredentialsRequestUrl = $magentoUrl . 'oauth/initiate?oauth_callback=' . urlencode($callbackUrl);
$adminAuthorizationUrl = $magentoUrl . 'admin/oauth_authorize';
$accessTokenRequestUrl = $magentoUrl . 'oauth/token';
$apiUrl = $magentoUrl . 'api/rest';
$consumerKey = 'OAUTH CONSUMER KEY'; // Get from System > Web Services > REST - OAUTH Consumers > Edit Consumer > Key
$consumerSecret = 'OAUTH CONSUMER SECRET'; // Get from System > Web Services > REST - OAUTH Consumers > Edit Consumer > Secret
@dfrankland
dfrankland / gmail.sh
Created June 4, 2015 02:23
Automate Gmail SMTP login to send email via sh script.
#!/bin/sh
smtpsrv="smtp.gmail.com"
smtpport="587"
smtpusr=""
smtppwd=""
username64=$( echo $smtpusr | base64 ) # $( base64_encode $smtpusr )
password64=$( echo $smtppwd | base64 ) # $( base64_encode $smtppwd )
(
echo "EHLO localhost"; sleep 3;
@dfrankland
dfrankland / wpa-connect.sh
Last active November 11, 2017 15:16
Connect to a WPA-EAP IEEE8021X Enterprise Wireless Access Point using pfSense.
#!/bin/sh
# More info on wpa_supplicant configuration:
# https://w1.fi/cgit/hostap/plain/wpa_supplicant/wpa_supplicant.conf
# INSIDE PFSENSE DO NOT "ENABLE WPA" ON THE INTERFACE YOU ARE TRYING TO USE BELOW
interface="" # Your wifi interface eg "ath0_wlan0" (DO NOT "ENABLE WPA")
ssid="" # SSID of the AP you're connecting to
identity="" # Your 802.1X Enterprise username