Skip to content

Instantly share code, notes, and snippets.

View dankimio's full-sized avatar
:octocat:

Dan Kim dankimio

:octocat:
View GitHub Profile
@dankimio
dankimio / google_sheets_deepl.js
Last active February 28, 2022 14:41 — forked from enogylop/deepl_for_google_sheets.txt
DeepL for Google Sheets
// Replace auth_key with a "Deepl for developer" API key
// Source: http://5.9.10.113/67485395/google-sheets-custom-function-to-translate-with-deepl-api-not-working-as-expecte
function deepl(text, sourceLang, targetLang) {
const authKey = 'xxxx-xxxx-xxxx-xxxx-xxxx'
const url = `https://api-free.deepl.com/v2/translate?auth_key=${authKey}&text=${encodeURIComponent(text)}&target_lang=${targetLang}&source_lang=${sourceLang}`
const response = UrlFetchApp.fetch(url)
const json = response.getContentText()
const data = JSON.parse(json)
return data.translations && data.translations.length > 0 ? data.translations[0].text : "No value"
@dankimio
dankimio / find_orphan_photos.rb
Created December 1, 2021 13:33
Find orphan photos
PATH = '/Volumes/LaCie/Photos/Lightroom Catalog 2021/'
Dir.chdir(PATH)
rafs = Dir['*.raf']
rafs.each do |raf|
filename = raf.split('.').first
next if Dir["#{filename}.jpg"].any?