Skip to content

Instantly share code, notes, and snippets.

@mvark
mvark / IPLookup.js
Created May 6, 2021 10:08
Bookmarklet that calls a REST API to fetch geolocation details for a given IP address
//IP LOCATION TRACKER BOOKMARKLET
//Original source: https://funbutlearn.com/2016/06/ip-location-tracker-bookmarklet-created.html
//modified API service from http://ip-api.com which doesn't support HTTPS to https://ipapi.co/ to have a secure endpoint & avoid Mixed Content blocking issue
javascript: (function() {
var text = "";
if (window.getSelection) {
text = window.getSelection().toString();
} else if (document.selection && document.selection.type != "Control") {
text = document.selection.createRange().text;
}
@sekjal
sekjal / handler.py
Created March 19, 2021 13:18
Rebuild FOLIO Instance from MARC
import requests
import json
import uuid
from datetime import datetime, timedelta
import os
from folioclient.FolioClient import FolioClient
def handle(event, context):
if event.method != 'POST':
return {
@anarchivist
anarchivist / permissive.py
Created November 24, 2012 22:36
Permissive MARC Reader subclass for pymarc
import pymarc
from pymarc.exceptions import RecordLengthInvalid, RecordLeaderInvalid
from pymarc.exceptions import BaseAddressInvalid, BaseAddressNotFound
from pymarc.exceptions import RecordDirectoryInvalid, NoFieldsFound
class PermissiveMARCReader(pymarc.MARCReader):
"""PermissiveMARCReader: recovers from most pymarc exceptions"""
def __init__(self, marc_target, to_unicode=False, force_utf8=False,
hide_utf8_warnings=False, utf8_handling='strict'):
super(PermissiveMARCReader,self).__init__(marc_target, to_unicode,
@marc0der
marc0der / gist:4095013
Created November 17, 2012 11:13
Add environments to Gradle build
def loadConfiguration() {
def environment = hasProperty('env') ? env : 'dev'
ext.environment = environment
println "Environment is set to: $environment"
def configFile = file('config.groovy')
def config = new ConfigSlurper(environment).parse(configFile.toURL())
ext.config = config
}