Skip to content

Instantly share code, notes, and snippets.

View zudochkin's full-sized avatar
😻

Dmitry Zudochkin zudochkin

😻
View GitHub Profile
@zudochkin
zudochkin / Readme.md
Created February 6, 2024 06:29 — forked from QWxleA/Readme.md
Obsidian zotero template for use with "obsidian-zotero-integration" plugin

QWxlea's over-engineered zotero template

Faq

What are these %% begin id-pn2xitti%% and %% end id-pn2xitti %% and ^pn2xitti? These are the persistance-markers of the indivual highlights, and the reference-id to that highlight.

The markers are meant for the importer. It will skip all text within those markers, so they stay when updating a zotero-import. Removing a marked block does not work well, it will not be reimported. Don't know how to fix that. If you want to reimport a highlight-block, best is to change the highlight in zotero (for example change the color). This will update the id, and on the next import the new highlight will be imported.

The reference-id is used like this: [[@name-of-the-note#^pn2xitti]]

@zudochkin
zudochkin / mdCalendar.js
Created January 3, 2024 10:49
Calendar Builder for Obsidian
// get DailyNotes template settings for weekly and daily notes
const periodicNotes = app.plugins.plugins["periodic-notes"];
const periodicNotesSetings = periodicNotes.settings;
function mdCalendar(year, month, mondayFirst) {
if (mondayFirst === undefined) mondayFirst = false;
//Step 1: build an array of the abbreviated weekday names
let dd = new Date(2022, 1, 27); //a Sunday
let wnames = [];
for (let i = 0; i < 8; i++) {
@zudochkin
zudochkin / gist:ea505649bdaceb7b27b059cca9e24928
Created January 12, 2017 09:54 — forked from asabaylus/gist:3071099
Github Markdown Heading Anchors

Anchors in Markdown

To create an anchor to a heading in github flavored markdown. Add - characters between each word in the heading and wrap the value in parens (#some-markdown-heading) so your link should look like so:

[create an anchor](#anchors-in-markdown)

@zudochkin
zudochkin / sync-postgres-mina.rb
Created November 23, 2015 14:27 — forked from nicolai86/sync-postgres-mina.rb
sync down the content of a postgresql database used by a rails application using mina.
RYAML = <<-BASH
function ryaml {
ruby -ryaml -e 'puts ARGV[1..-1].inject(YAML.load(File.read(ARGV[0]))) {|acc, key| acc[key] }' "$@"
};
BASH
namespace :sync do
task :db do
isolate do
invoke :environment
@zudochkin
zudochkin / osx-for-hackers.sh
Last active August 29, 2015 14:27 — forked from brandonb927/osx-for-hackers.sh
OSX for Hackers: Yosemite Edition. This script tries not to be *too* opinionated and any major changes to your system require a prompt. You've been warned. Also, please don't email me about this script, my poor inbox...
#!/bin/sh
# Alot of these configs have been taken from the various places
# on the web, most from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Set the colours you can use
black='\033[0;30m'
white='\033[0;37m'
red='\033[0;31m'
#!/usr/bin/env ruby
# gem install pdf_forms
if ARGV.size < 2
puts "USAGE pdf-fill-out-checkboxes INPUT OUTPUT"
exit
end
require 'pdf_forms'
@zudochkin
zudochkin / length.hs
Created February 9, 2015 13:47
Haskell: first steps
main :: IO()
len :: [a] -> Int
len [] = 0
len (_:xs) = 1 + len xs
main = putStrLn $ "The length is: " ++ show (len [1, 2, 3, 4, 5])
WITH table_scans as (
SELECT relid,
tables.idx_scan + tables.seq_scan as all_scans,
( tables.n_tup_ins + tables.n_tup_upd + tables.n_tup_del ) as writes,
pg_relation_size(relid) as table_size
FROM pg_stat_user_tables as tables
),
all_writes as (
SELECT sum(writes) as total_writes
FROM table_scans
# A small DSL for helping parsing documents using Nokogiri::XML::Reader. The
# XML Reader is a good way to move a cursor through a (large) XML document fast,
# but is not as cumbersome as writing a full SAX document handler. Read about
# it here: http://nokogiri.org/Nokogiri/XML/Reader.html
#
# Just pass the reader in this parser and specificy the nodes that you are interested
# in in a block. You can just parse every node or only look inside certain nodes.
#
# A small example:
#
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')