Skip to content

Instantly share code, notes, and snippets.

const api = require('zotero-api-client'); // >= 0.36.0
const fs = require('fs');
const SparkMD5 = require('spark-md5');
const filedata1 = fs.readFileSync('picture-v1.jpg');
const filedata2 = fs.readFileSync('picture-v2.jpg');
const APIKEY = '';
const USERID = '';
const ITEM_KEY = '';
const api = require('./src/api');
const fs = require('fs');
const filedata = fs.readFileSync('picture.jpg');
// live api, vexlign credentials
const APIKEY = '';
const USERID = '';
const ITEM_KEY = '';
(async () => {
@tnajdek
tnajdek / .slate.js
Last active October 18, 2018 12:43
My basic slate file
var moveops = [];
for(let j = 1; j < 5; j++) {
moveops[j] = [];
for(let i = 0; i < j; i++) {
moveops[j][i] = [];
for(let k = 0; k < 5; k++) {
let f = win => {
let op = slate.operation("move", {
x: `screenOriginX + ${i} * (screenSizeX/${j})`,
@tnajdek
tnajdek / guessmovies.py
Created April 3, 2015 19:47
This simple script will guess movie titles based on the file names and move them to collection dir
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# This simple script will guess movie titles based on the file names and move them to collection dir
# Useful when you have movies with names like Star.Wars.Phantom.Menace.mkv and you want them
# in your collection in folders like Star Wars: Episode VI - Return of the Jedi (1983)
# To get dependencies run `pip install IMDbPY==5.0 guessit==0.10.2`
from __future__ import print_function
import os
import argparse
import imdb
@tnajdek
tnajdek / charts.js
Created March 31, 2015 19:09
Handlebar helper I use with grunt-assemble to generate charts as images for a static blog
Handlebars.registerHelper('chart', function(width, height, type, title, options) {
var config = JSON.parse(options.fn(this)),
canvas = new Canvas(width, height),
ctx = canvas.getContext('2d'),
method = type[0].toUpperCase() + type.slice(1),
uniqueName = crypto.createHash('md5').update(width + height + type + title + options.fn(this)).digest('hex'),
chartFileName = uniqueName + '.png';
new Chart(ctx)[method](config);
@tnajdek
tnajdek / anchors.js
Created March 31, 2015 18:36
Assemble plugin to automatically generate and attach ids and anchor links to headers
/*eslint-env node */
var cheerio = require('cheerio'),
htmlStrip = require('htmlstrip-native');
var options = {
stage: 'render:post:page'
};
@tnajdek
tnajdek / .zshrc
Last active September 26, 2020 10:27
.zshrc for OSX
# ZSH history
setopt append_history
setopt hist_expire_dups_first
setopt hist_fcntl_lock
setopt hist_ignore_all_dups
setopt hist_lex_words
setopt hist_reduce_blanks
setopt hist_save_no_dups
setopt share_history
unsetopt menu_complete # do not autoselect the first completion entry
$breakpoints: (
'minimal': 320,
'small': 480,
'vga': 640,
'tablet': 768,
'medium': 800,
'large': 1000,
'sxga': 1280,
'wsxga': 1680,
'hd': 1920
@tnajdek
tnajdek / .gitignore
Created August 2, 2014 10:46
Unity .gitignore
# Unity generated #
# =============== #
Temp/
Obj/
UnityGenerated/
Library/
# ===================================== #
# Visual Studio / MonoDevelop generated #
# ===================================== #
# get yourt as root. Even after fucked up change in arch where makepkg just won't fucking work as root
cd /tmp
pacman -S --noconfirm base-devel
curl -O https://aur.archlinux.org/packages/pa/package-query/package-query.tar.gz
tar zxvf package-query.tar.gz
chmod -R 777 package-query
cd package-query
sudo -u nobody makepkg -s --noconfirm
pacman -U --noconfirm *.tar.xz
cd ..