Skip to content

Instantly share code, notes, and snippets.

View tdiprima's full-sized avatar

Tammy DiPrima tdiprima

View GitHub Profile
@tdiprima
tdiprima / .editorconfig
Created June 9, 2021 14:03 — forked from wzup/.editorconfig
.editorconfig file example
# ВСЕ СВОЙСТВА СМ. ВНИЗУ ФАЙЛА
# или здесь с описанием https://github.com/editorconfig/editorconfig/wiki/EditorConfig-Properties
#
# EditorConfig helps developers define and maintain consistent
# coding styles between different editors and IDEs
# http://editorconfig.org
root = true
[*]
@tdiprima
tdiprima / iiifUrlParser.js
Created April 2, 2021 20:44
IIIF URL Parser
// JavaScript IIIF URL Parser
// Adapted from: https://github.com/NCSU-Libraries/iiif_url/blob/master/lib/iiif_url.rb
// IIIF Image API: https://iiif.io/api/image/3.0/
function isNumeric(str) {
if (typeof str != "string") return false
return !isNaN(str) && !isNaN(parseFloat(str))
}
function parse(url) {
let w, h, identifier
@tdiprima
tdiprima / names-generator.js
Last active April 2, 2021 20:33
Random name generator (like Docker)
// Adapted from https://github.com/moby/moby/tree/master/pkg/namesgenerator
let adjectives=["admiring","adoring","affectionate","agitated","amazing","angry","awesome","beautiful","blissful","bold","boring","brave","busy","charming","clever","cool","compassionate","competent","condescending","confident","cranky","crazy","dazzling","determined","distracted","dreamy","eager","ecstatic","elastic","elated","elegant","eloquent","epic","exciting","fervent","festive","flamboyant","focused","friendly","frosty","funny","gallant","gifted","goofy","gracious","great","happy","hardcore","heuristic","hopeful","hungry","infallible","inspiring","interesting","intelligent","jolly","jovial","keen","kind","laughing","loving","lucid","magical","mystifying","modest","musing","naughty","nervous","nice","nifty","nostalgic","objective","optimistic","peaceful","pedantic","pensive","practical","priceless","quirky","quizzical","recursing","relaxed","reverent","romantic","sad","serene","sharp","silly","sleepy","stoic","strange","stupefie
@tdiprima
tdiprima / global-gitignore.md
Created November 1, 2020 18:17 — forked from subfuzion/global-gitignore.md
Global gitignore

There are certain files created by particular editors, IDEs, operating systems, etc., that do not belong in a repository. But adding system-specific files to the repo's .gitignore is considered a poor practice. This file should only exclude files and directories that are a part of the package that should not be versioned (such as the node_modules directory) as well as files that are generated (and regenerated) as artifacts of a build process.

All other files should be in your own global gitignore file. Create a file called .gitignore in your home directory and add anything you want to ignore. You then need to tell git where your global gitignore file is.

Mac

git config --global core.excludesfile ~/.gitignore

Windows

git config --global core.excludesfile %USERPROFILE%\.gitignore
@tdiprima
tdiprima / dzi_to_iiif.py
Created October 15, 2020 14:09 — forked from jpstroop/dzi_to_iiif.py
DZI syntax to IIIF
# Take params from the DZI syntax and turn them into an IIIF request
#
# Copyright (C) 2009 CodePlex Foundation
# Copyright (C) 2010-2013 OpenSeadragon contributors
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# - Redistributions of source code must retain the above copyright notice,
@tdiprima
tdiprima / trim-canvas.js
Created December 20, 2018 13:53 — forked from remy/trim-canvas.js
Trims the surrounding transparent pixels from a canvas
// MIT http://rem.mit-license.org
function trim(c) {
var ctx = c.getContext('2d'),
copy = document.createElement('canvas').getContext('2d'),
pixels = ctx.getImageData(0, 0, c.width, c.height),
l = pixels.data.length,
i,
bound = {
top: null,
@tdiprima
tdiprima / getin.sh
Created June 28, 2017 15:20
Get into Docker container
#!/bin/bash
if [ $# -eq 0 ]
then
container_name="YOUR-CONTAINER" # change to whatever default container you like
else
container_name="$1"
fi
containerId=$(docker inspect --format '{{ .Id }}' "$container_name")
@tdiprima
tdiprima / new_view_redo.sh
Last active June 28, 2017 15:59
Spin up a docker container
#!/bin/bash
if [ $# -eq 0 ]
then
# change to whatever default you like
IMAGE_NAME="YOUR-DOCKER-IMAGE"
CONTAINER_NAME="YOUR-DOCKER-CONTAINER"
REPO_NAME="YOUR-GITHUB-REPOSITORY" # NOTE: Name only; not the URL.
else
IMAGE_NAME="$1"
@tdiprima
tdiprima / backup-github.sh
Last active March 3, 2017 21:01 — forked from darktim/backup-github.sh
If you have more than 30 Repositories, the original script will not download all. The github api limits the entries to 30 per page but you can raise that up to 100. I have added a small loop which sets the limit to 90 and cycles through all pages until the listing on a page is empty...
#!/bin/bash
# A simple script to backup an organization's GitHub repositories.
TSTAMP=$(date +%Y-%m-%d_%H-%M-%S)
GHBU_BACKUP_DIR=${TSTAMP} # where to place the backup files
GHBU_ORG_TYPE=${GHBU_ORG_TYPE-"<CHANGE-ME>"} # are you doing an organization or a user (orgs | users)
GHBU_ORG=${GHBU_ORG-"<CHANGE-ME>"} # the GitHub organization (or GitHub username) whose repos will be backed up
GHBU_UNAME=${GHBU_UNAME-"<CHANGE-ME>"} # the username of a GitHub account (to use with the GitHub API)
GHBU_PASSWD=${GHBU_PASSWD-"<CHANGE-ME>"} # the password for that account
GHBU_GITHOST=${GHBU_GITHOST-"github.com"} # the GitHub hostname (see notes)