Skip to content

Instantly share code, notes, and snippets.

@danieroux
danieroux / obsidian-web-clipper.js
Last active December 5, 2023 22:31 — forked from kepano/obsidian-web-clipper.js
Obsidian Web Clipper Bookmarklet to save articles and pages from the web (for Safari, Chrome, Firefox, and mobile browsers)
javascript: Promise.all([import('https://unpkg.com/turndown@6.0.0?module'), import('https://unpkg.com/@tehshrike/readability@0.2.0'), ]).then(async ([{
default: Turndown
}, {
default: Readability
}]) => {
/* Optional vault name */
const vault = "";
/* Optional folder name such as "Clippings/" */
@danieroux
danieroux / sql_name.clj
Created October 1, 2021 22:14
Turning a Clojure keyword into a SQL-safe name
(def ^:private make-boring-regex #"[*.?!:+-]")
(defn sql-name
"Makes `kw` a SQL-safe string.
/ becomes __
All other SQL-unsafe chars become _"
[kw]
(let [name-xf (clojure.string/replace (name kw) make-boring-regex "_")]
(if (namespace kw)
(let [ns-xf (clojure.string/replace (namespace kw) make-boring-regex "_")]
import csv
def invert(filename):
with open(filename + ".csv", "rb") as csvfile:
reader = csv.reader(csvfile, delimiter=",", quotechar='"')
with open(filename + "_inverted.csv", "wb") as csvfilew:
writer = csv.writer(csvfilew, delimiter=",", quotechar='"', quoting=csv.QUOTE_ALL)
first_done = False
for row in reader:
if first_done:
#!/usr/bin/evn python
#
# Rough but serviceable Standard Bank South Africa PDF statement to CSV extraction.
# Exports to Xero's import format
#
# Needs:
# - poppler
# - lxml for python to be installed (pip install lxml)
from lxml import etree as ET
(org-add-link-type "twittering" 'twittering-org:open)
(add-hook 'org-store-link-functions 'twittering-org:store-link)
(defun twittering-org:open (id-str)
(twittering-visit-timeline (concat ":single/" id-str)))
(defun twittering-org:store-link ()
"Store a link to a tweet."
(when (and (twittering-buffer-p) (twittering-get-id-at))
(let ((status (twittering-find-status (twittering-get-id-at))))
(apply 'org-store-link-props
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by libffi configure 3.0.13, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ .././configure --srcdir=.. --enable-builddir=x86_64-apple-darwin11.4.2 --disable-static --disable-dependency-tracking --prefix=/nix/store/4qzrm4946gy3av9wy04n8v3ljzzx3flh-libffi-3.0.13
## --------- ##
## Platform. ##
tell application "System Events" to if exists process "Adium" then
tell application "Adium"
set account_list to every account
repeat with acc in account_list
set stat to status of acc
set status type of acc to available
set status message of acc to "Available."
set autoreply of stat to no
end repeat
end tell
import Data.List
data Point = Point Int Int deriving Show
data Direction = DLeft
| DRight
| DStraight
findPointP :: [Point] -> [Point]
findPointP points = sortBy smallestYthenX points
where smallestYthenX (Point x1 y1) (Point x2 y2)
# Supporting class for demo purposes
class DatabaseStub
attr_reader :name
def self.instances
["development", "test", "ci"]
end
def initialize(databaseName)
@name = databaseName
["development", "test", "ci"].each do |databaseName|
namespace databaseName do
desc "stop"
task "stop" do |t|
puts "Action stop would now be performed on database #{t.scope}"
end
end
end