Skip to content

Instantly share code, notes, and snippets.

View AlekseyDurachenko's full-sized avatar

Aleksey Durachenko AlekseyDurachenko

View GitHub Profile
#!/usr/bin/python3
from PIL import Image
from PIL import ImageFilter
import glob
for filename in glob.glob('*.jpg'):
im = Image.open(filename)
print("IMAGE:", filename)
print("SIZE :", im.size)
@AlekseyDurachenko
AlekseyDurachenko / darktable_xmp_migrate_from_2_0_X_to_2_2_3.py
Last active February 27, 2017 18:06
Fix levels inside darktable xmp files (migration from version 2.0.7 to 2.2.3)
#!/usr/bin/python3
import struct
import binascii
import sys
if len(sys.argv) != 2:
print("Usage:")
print(" darktable_xmp_migrate_from_2_0_X_to_2_2_3.py filename")
print("")
@AlekseyDurachenko
AlekseyDurachenko / gist:a3194313f145321e03ada9b1c510dfcd
Last active January 15, 2017 09:08
Скрипт для определения контуров отсканированных фотографий (http://alekseydurachenko.github.io/2017/01/13/scanned_photos_contours_with_opencv.html)
#!/usr/bin/python2
# -*- coding: utf-8 -*-
#
# Copyright 2017, Durachenko Aleksey V. <durachenko.aleksey@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
@AlekseyDurachenko
AlekseyDurachenko / cyclicchangeofthevalue.cpp
Last active January 6, 2016 07:11
cyclic change of the value
const qlonglong delta = qAbs(oldValue - newValue) % qAbs(m_maximum - m_minimum);
if (newValue < m_minimum) {
newValue = m_maximum - (delta - (oldValue - m_minimum));
}
else if (newValue > m_maximum) {
newValue = m_minimum + (delta - (m_maximum - oldValue));
}
#!/bin/bash
set -e
SRC_PATH="/some/path/"
DATE=`date "+%Y%m%d_%H%M%S"`
CUR_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
FILE=`find $CUR_DIR -mindepth 1 -maxdepth 1 -type 'd' | sort -r | head -1`
if [ "$FILE" ]; then
cp -al $FILE $CUR_DIR/$DATE
CMainWindow::~CMainWindow()
diff --git a/examples/sndfileview_sync/src/csppsyncpeakdatasource.cpp b/examples/sndfileview_sync/src/csppsyncpeakdatasource.cpp
index efa6430..8f3e889 100644
--- a/examples/sndfileview_sync/src/csppsyncpeakdatasource.cpp
+++ b/examples/sndfileview_sync/src/csppsyncpeakdatasource.cpp
@@ -14,8 +14,10 @@
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#include "csppsyncpeakdatasource.h"
+#include <math.h>
#!/bin/bash
set -e # abort if any command failed
# MP3 player must be attached to the USB
if [ ! -b /dev/disk/by-uuid/2408-0200 ]
then
echo "MP840 is not attached"
exit 1
fi
#!/bin/bash
# usage
if [ "$#" -ne 1 ]; then
echo "Usage:"
echo " run_script_with_lock-dbus_in_crontab.sh <command_or_script_name>"
exit 1
fi
# aliases
@AlekseyDurachenko
AlekseyDurachenko / simple_singleton.h
Last active August 29, 2015 14:01
The simple singleton
// usage: MyClass *MyClass = singleton<MyClass>();
template <class Type>
inline Type *singleton()
{
static Type *x = new Type;
return x;
}