Skip to content

Instantly share code, notes, and snippets.

@einichi
einichi / barcode-reader.py
Created April 27, 2021 14:11
Pulls barcodes from images with OpenCV and reads them with pyzbar
import os
import cv2
from pyzbar.pyzbar import decode
# Set your directory of images here, make sure no non-image files exist
directory = "./images/"
for file in os.listdir(directory):
# Load image into CV2
image = cv2.imread(directory+file)

Keybase proof

I hereby claim:

  • I am einichi on github.
  • I am einichi (https://keybase.io/einichi) on keybase.
  • I have a public key ASCQze08h-GeTG20PL41yDU0l8cO-6FHfFPHhtERp3TLMgo

To claim this, I am signing this object:

@einichi
einichi / getIP.gs
Created December 25, 2019 07:50
Get IP Address of Hostname - Google App Script
function getIP(host, recordType) {
// Specify record type as per described here: https://en.wikipedia.org/wiki/List_of_DNS_record_types
// For example, 'A', 'AAAA', 'NS', etc...
// So your Google Sheets formula would be =getIP("www.example.com", "A")
var url = "https://dns.google.com/resolve?name=" + host + "&type=" + recordType;
var json = UrlFetchApp.fetch(url);
var response = JSON.parse(json);
var answer = response.Answer;
var ip = "";
if (typeof answer != "undefined") {
@einichi
einichi / export-keep.js
Last active May 1, 2022 18:02
Exports Google Keep notes to CSV (text only), run in JS console when on keep.google.com
var elements = document.getElementsByTagName("*"); // Grab all elements, since the actual note content elements have no ID are seemingly randomly generated class IDs
var keepTitle = [];
var keepContent = [];
var x = 0;
for (var i=0; i < elements.length; i++) { // Loop through all elements
if (elements[i].hasAttribute("contenteditable") && elements[i].getAttribute("contenteditable") == "false") { // Elements with 'contenteditable' attr set to false in the Keep page are fortunately only note title and contents
if (x % 2 == 0) { // Simple means of separating title from contents
if (elements[i].innerHTML == "") { // Make it clear if the field was empty
keepTitle.push("(empty)");
}