Skip to content

Instantly share code, notes, and snippets.

View jeremija's full-sized avatar

Jerko Steiner jeremija

View GitHub Profile

Sends HTTP File to AppleTV for Playback

go get github.com/jeremija/appletv
appletv [apple-tv-host:port] [http-url-to-play]

Running from source:

@jeremija
jeremija / go.md
Created March 6, 2020 07:17
go example
// db/db.go
type MyDB struct {
  DB *sql.DB
}

func Exec(query string, params... interface{}) error {...}
func Select(target interface{}, query string, params... interface) error {...}
@jeremija
jeremija / .tern-project
Created October 20, 2017 19:42
Tern plugin to work with babel-plugin-module-resolver
{
"libs": [],
"loadEagerly": [],
"plugins": {
"node": {},
"es_modules": {},
"module-resolver": {
"cwd": "packagejson",
"alias": {
"my-alias1": "./path/to/my/module1",
@jeremija
jeremija / index.js
Last active September 26, 2017 01:59
knex raw query with where (example)
'use strict'
const knex = require('knex')
const { expect } = require('chai')
const db = knex({
client: 'sqlite3',
connection: ':memory:',
useNullAsDefault: true
})
describe('raw', () => {
@jeremija
jeremija / init.lua
Created May 24, 2017 12:35 — forked from juanmiret/init.lua
Simple Vi mode with Karabiner-elements and Hammerspoon
local module = {}
module.debugging = false -- whether to print status updates
local eventtap = require "hs.eventtap"
local event = eventtap.event
local inspect = require "hs.inspect"
local keyHandler = function(e)
local watchFor = {
@jeremija
jeremija / update-node-deps.js
Created April 27, 2017 19:19
update node deps
'use strict';
const pkg = require('./package.json');
const _ = require('underscore');
const fs = require('fs');
const deps = {};
fs.readFileSync('./deps').toString().split('\n').forEach(row => {
row = row.split('@');
deps[row[0]] = row[1];
});
@jeremija
jeremija / create-cert.sh
Last active June 25, 2019 08:01
Create root CA and certificates
#!/bin/bash
DOMAIN=$1
MERGED="$DOMAIN-merged.crt"
echo "Generating private key for certificate signing request" > /dev/stderr
openssl genrsa -out $DOMAIN.key 2048
echo "Creating a certificate signing request" > /dev/stderr
openssl req -new -key $DOMAIN.key -out $DOMAIN.csr \
@jeremija
jeremija / socat.sh
Created February 18, 2016 14:54
forward port 8080 to port 80
sudo socat tcp-listen:80,reuseaddr,fork tcp:localhost:8080
<!-- updating input will update automatically update span -->
<input type="text" data-bind="value: observable">
<span data-bind="text: observable"></span>
<!-- iterate over observableArray -->
<ul data-bind="foreach: observableArray">
<li data-bind="text: $data"></li>
</ul>
<input type="text" data-bind="value: x">
@jeremija
jeremija / tag.sh
Created November 30, 2015 15:43
Automatically create git tags from svn tags
#!/bin/bash
git log --oneline | grep 'prepare release' | while read line; do
COMMIT_ID=$(echo $line | cut -f 1 -d ' ')
VERSION=$(echo $line | sed 's/.*prepare release \(.*\)$/\1/g')
echo $COMMIT_ID is $VERSION
git tag "v$VERSION" $COMMIT_ID~1
done