Skip to content

Instantly share code, notes, and snippets.

@laurynas
laurynas / exif_sort.rb
Last active March 31, 2018 15:28
Adjust exif times to preserve sorting for Google Photos (if all photos are set to the same time)
gem 'mini_exiftool'
require 'mini_exiftool'
files = Dir["./*.JPG"].sort
t = Time.parse('2003-08-01 12:00:00 +0300')
files.each_with_index do |file, i|
photo = MiniExiftool.new file
photo.date_time_original = t + i
@laurynas
laurynas / audit.rake
Created March 25, 2017 10:07
Bundler security audit rake task
# run with `bundle:audit_and_notify`
require 'bundler/audit/task'
Bundler::Audit::Task.new
task default: 'bundle:audit'
namespace :bundle do
desc 'Audit and notify about gem vulnerabilities'
task audit_and_notify: :environment do

> crystal test.cr

Undefined symbols for architecture x86_64:
  "std::string::_Rep::_M_destroy(std::allocator<char> const&)", referenced from:
      Hello::hello(char const*) in hello.a(libhello.o)
  "std::string::_Rep::_S_empty_rep_storage", referenced from:
      Hello::hello(char const*) in hello.a(libhello.o)
  "std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&)", referenced from:
      Hello::hello(char const*) in hello.a(libhello.o)
@laurynas
laurynas / dummy_server.rb
Created June 12, 2016 05:14
Debug memached socket timeouts
#!/usr/bin/env ruby
require 'socket'
s = UNIXServer.new '/tmp/dummymemcached'
#s = TCPServer.new 11212
loop do
c = s.accept
line = c.gets
using RestSharp;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication1
{
public class Detection
@laurynas
laurynas / detectlanguage-batch.json
Created December 29, 2014 22:29
detectlanguage.com batch detection result example
{
"data":{
"detections":[
[
{
"language":"es",
"isReliable":true,
"confidence":10.24
}
],
@laurynas
laurynas / openelec-remote-setup.txt
Last active August 29, 2015 14:05
Openelec / XBMC Thomson remote setup
00131849 Thomson ROC 5112 Universal 5in1 Remote Control
https://de.hama.com/00131849/thomson-roc-5112-universal-5in1-remote-control
# Thomson universal remote setup, on remote:
# 1. Click and hold SETUP
# 2. Select DVD (TV or other)
# 3. Enter 1063 (@SAT, almost all keys send signal)
# The remote is programmed.
# Thomson remote notes:
#!/usr/bin/env ruby
# vim: set syntax=ruby
flag = false
files = `git diff --cached --name-only --diff-filter=ACM`.split("\n")
files.each do |file|
results = `git diff --cached #{file} | grep "^\+[^+]" | grep -e "binding.pry" -e "focus: true" -e ":focus => true" -e "console.log" -e "debugger"`.split("\n").map { |r| r.sub(/^\+[\s\t]*/, '') }
if $? == 0
@laurynas
laurynas / knedliku_teorija.txt
Created June 23, 2014 14:02
Knedlikų teorija
https://web.archive.org/web/20050405113624/http://www.road.lt/keliautojai/am/pasakojimai/30/
Antanas Marcelionis
Vilnius – Valensija autostopu. Antroji dalis
2000 Spalis; Vokietija, Čekija
Juokingą atstumą nuo Prahos iki Vokietijos sienos įveikėme begėdiškai ilgai – užtrukome beveik visą dieną. Dykas buvimas pagimdė mūsų galvose istoriją apie KNIEDLIKUS. Mes maždaug žinojome, kad kniedlikai tai kažkokia nacionalinė čekiška bulka, tačiau nusprendėme, kad vistik tai yra nacionalis augalas. Ir prasidėjo.
KNIEDLIKŲ TEORIJA (galite tikėti, bet geriau ne)
@laurynas
laurynas / mddev.conf
Created October 26, 2012 16:03
Mysql on ramdrive
description "MD Development Environment"
author "Laurynas Butkus"
#start on startup
#stop on shutdown
stop on runlevel [016]
pre-start script
stop mysql
mkdir -p /mnt/ramdrive