Skip to content

Instantly share code, notes, and snippets.

View twoblokeswithapostie's full-sized avatar

Mario Gudelj twoblokeswithapostie

View GitHub Profile
@twoblokeswithapostie
twoblokeswithapostie / gist:9b3e7314ffc9de6e7bb94ff174594e3b
Created March 31, 2017 00:09
Boto3 suddenly stops authenticating with valid credentials
Update system date with:
sudo ntpdate us.pool.ntp.org
That'll fix it!
@twoblokeswithapostie
twoblokeswithapostie / organisation_structured_data_example
Created September 8, 2016 01:10
Structured data example for an organisation
<div class="contact-details" itemscope="" itemtype="http://schema.org/Organization"><span itemprop="name" class="hide">Shimmering Careers</span><p><b style="font-size: 1.2em; line-height: 1.6em;">Our Offices:</b></p><p itemprop="address" itemscope="" itemtype="http://schema.org/PostalAddress"><span itemprop="streetAddress">1777 Borel Place, Suite 440</span>, <span itemprop="addressLocality">San Mateo</span>, <span itemprop="addressRegion">CA</span><span itemprop="postalCode"> 94402</span></p><p itemprop="address" itemscope="" itemtype="http://schema.org/PostalAddress"><span itemprop="streetAddress">1220 University Drive, Suite 104</span>, <span itemprop="addressLocality">Menlo Park</span>, <span itemprop="addressRegion">CA</span><span itemprop="postalCode"> 94025</span></p><p><b>Phone:</b>&nbsp;<a data-original-title="" href="tel:650-464-0085" title=""><span itemprop="telephone">650-464-0085</span></a></p><p><span><b>Toll-Free:&nbsp;</b></span><a data-original-title="" href="tel:1-877-796-9737" title="Toll-fr
@twoblokeswithapostie
twoblokeswithapostie / gist:84b43f046c9099a57ce7
Last active August 29, 2015 14:23
jQuery DOM element shuffler
// jQuery shuffle plugin usage $('el').shuffle();
(function($){
$.fn.shuffle = function() {
var elements = this.get();
var copy = [].concat(elements);
var shuffled = [];
var placeholders = [];
@twoblokeswithapostie
twoblokeswithapostie / gist:0eafef3888506190a977
Created June 15, 2015 01:56
BC to Bootstrap form converter - INCOMPLETE but almost there
from bs4 import BeautifulSoup
## TODO: Add wrapper for non-input fields and embed fields into labels
def exctract_field(el):
print el
inputs = el.find_all('input')
if inputs:
return inputs, "input"
selects = el.find_all('select')
@twoblokeswithapostie
twoblokeswithapostie / gist:ba738b283134ad91d664
Last active August 29, 2015 14:23
Delete a list of CRM records from BC by reading a CSV file
from suds import WebFault
from suds.client import Client
from bc_api.models.crm import *
import csv
def delete_from_bc(site, entityId):
url = str(site.secure_site_url + 'catalystwebservice/catalystcrmwebservice.asmx?WSDL')
client = Client(url)
try:
response = client.service.Contact_DeleteByEntityID(
@twoblokeswithapostie
twoblokeswithapostie / gist:9359477
Created March 5, 2014 01:29
Code using Momentjs for finding, today, this weekend, this months and next month to and from dates
// JavaScript code that finds dates for today, this weekend, this month, next month
// This weekend = next Sat and Sun
// This month = today to end of this month
// Next month = 1st of next month = end of next month
// Useful on Business Catalyst web app search form for searching from-to dates
// Requires jquery and moment.js
$(document).ready(function(){
$('#today_nav').on("click", function(){
# Extracts MP3 file links from Business Catalyst RSS feed
from urllib import urlopen
import re
source = urlopen('http://www.businesscatalyst.com/RSSRetrieve.aspx?ID=41&Type=RSS20').read()
link = re.compile('&lt;a href=(.*)\.mp3')
find_link = re.findall(link, source)
for link in find_link:
print "Link: %s \n" %link
import os
to_replace = """eval(base64_decode("DQplcnJvcl9yZXBvcnRpbmco...9DQp9"));"""
for dname, dirs, files in os.walk("/Users/mariogudelj/code/device.com/public_html/"):
for fname in files:
fpath = os.path.join(dname, fname)
with open(fpath) as f:
s = f.read()
found = s.find(to_replace)
if(found != -1):
print fpath