This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import urllib.request | |
import urllib.error | |
# This function checks the headers returned from a urllib.request object | |
def check_imagelinks(imglist): | |
for img in imglist: | |
try: | |
with urllib.request.urlopen(img) as response: | |
# headers are returned as tuples so cast that as a list |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function onInstall(e){ | |
onOpen(e); | |
} | |
function onOpen(e){ | |
var menu = SpreadsheetApp.getUi().createAddonMenu(); | |
menu.addItem('Remove Empty Rows', 'removeEmptyRows'); | |
menu.addToUi(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function addTimestamp(){ | |
var ss = SpreadsheetApp.getActiveSpreadsheet(); | |
var sheet = ss.getSheets()[0]; | |
var cell = sheet.getRange('A1'); | |
var d = new Date(); | |
d.setHours(d.getHours()); | |
var user = Session.getActiveUser().getUserLoginId(); | |
user = String(user); | |
// cosmetic: this just removes the email domain from the user info | |
user = user.replace('@gmail.com', ''); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Description: | |
# RCBOT Parrots what you said to the specified room | |
# | |
# Dependencies: | |
# None | |
# | |
# Commands: | |
# rcbot say in #devops "Something blah blah blah" | |
# | |
# Author: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Description: | |
# Hubot returns scripture using bibleverses package | |
# | |
# Dependencies: | |
# bibleverses | |
# | |
# Configuration: | |
# `npm install bibleverses --save` | |
# | |
# Commands: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// slight modification and re-application of daliborgogic/delay.js | |
const timeout = ms => new Promise(res => setTimeout(res, ms)); | |
// index is the index of an array member | |
async function throttle(index){ | |
console.log(`Index ${index} will fire after ${1500*index}ms`); | |
return timeout(index*1500); | |
} | |
// let's say you have an async operation that makes requests to certain endpoints |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import shutil | |
import csv | |
# to store filenames provided in csv | |
filenames = [] | |
# read single column csv of filenames (no extension) | |
csv_path = 'parts.csv' | |
with open(csv_path, newline='') as csvfile: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# simple user class | |
class User | |
def initialize(user_name, password) | |
@user_name = user_name | |
@password = password | |
end | |
attr_accessor :user_name | |
attr_accessor :password | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getCnNumber(x){ | |
if (x > 10 && x <= 20){ | |
const ch = '零一二三四五六七八九十'.split('').map((c, i) => x === i && c).find(s => s); | |
return '十' + ch; | |
} | |
else | |
return '零一二三四五六七八九十'.split('').map((c, i) => x === i && c).find(s => s); | |
} | |
function solveHuman(ans){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>Ansi 0 Color</key> | |
<dict> | |
<key>Alpha Component</key> | |
<real>1</real> | |
<key>Blue Component</key> | |
<real>0.13725490868091583</real> |