Skip to content

Instantly share code, notes, and snippets.

View zotero-api-client-upload-example.js
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 Oct 18, 2018
My basic slate file
View .slate.js
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 Apr 3, 2015
This simple script will guess movie titles based on the file names and move them to collection dir
View guessmovies.py
#!/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 Mar 31, 2015
Handlebar helper I use with grunt-assemble to generate charts as images for a static blog
View charts.js
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 Mar 31, 2015
Assemble plugin to automatically generate and attach ids and anchor links to headers
View anchors.js
/*eslint-env node */
var cheerio = require('cheerio'),
htmlStrip = require('htmlstrip-native');
var options = {
stage: 'render:post:page'
};
@tnajdek
tnajdek / .zshrc
Last active May 7, 2018
.zshrc for OSX
View .zshrc
# 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
View respond.scss
$breakpoints: (
'minimal': 320,
'small': 480,
'vga': 640,
'tablet': 768,
'medium': 800,
'large': 1000,
'sxga': 1280,
'wsxga': 1680,
'hd': 1920
@tnajdek
tnajdek / .gitignore
Created Aug 2, 2014
Unity .gitignore
View .gitignore
# Unity generated #
# =============== #
Temp/
Obj/
UnityGenerated/
Library/
# ===================================== #
# Visual Studio / MonoDevelop generated #
# ===================================== #
View getyaourt.sh
# 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 ..
View rsync-files.sh
#!/bin/bash
#rsync just new/changed files ignoring all meta/permissions/time/ownership/shitnot changes
rsync -aviz --no-p --no-t --no-o --no-g --ignore-times --size-only root@host:/some/remote/dir/ localdir/
You can’t perform that action at this time.