Skip to content

Instantly share code, notes, and snippets.

View Kedrigern's full-sized avatar

Ondřej Profant Kedrigern

View GitHub Profile
@Kedrigern
Kedrigern / Convert2cmyk.sh
Created September 23, 2011 20:50
My small but smart script for batch converting (and other manipulation) images to cmyk colorspace.
#!/bin/bash
# What do: Converting, manipulating etc. jpegs to CMYK colorspace
# Script is absolutly free/libre, but no guarantee.
# Author: Ondřej Profant
function 2cmyk {
echo -e "[info]\tThis operation needs a lot of CPU resources. Probably will take a long time."
for i in *.jpg ; do
mv $i ${i%.jpg}rgb.jpg
convert -depth 8 -colorspace cmyk -alpha Off ${i%.jpg}rgb.jpg ${i%.jpg}cmyk.jpg
@Kedrigern
Kedrigern / Tree.hs
Last active March 27, 2024 00:43
Implementation of binary search tree in Haskell
{- Implementation of BST (binary search tree)
Script is absolutly free/libre, but with no guarantee.
Author: Ondrej Profant -}
import qualified Data.List
{- DEF data structure -}
data (Ord a, Eq a) => Tree a = Nil | Node (Tree a) a (Tree a)
deriving Show
@Kedrigern
Kedrigern / ThreadsAndGui.cs
Created November 18, 2011 17:41
Threads oriented gui and concept of programm. Small example.
using System;
using System.Threading;
using Gtk;
namespace koncept
{
public static class MainClass
{
/* locks */
public static object lockEnd;
@Kedrigern
Kedrigern / frp.sh
Last active September 29, 2015 14:17
BASH: Find and replace index entry in LaTeX files with many options.
#!/bin/bash
#==============================================================================
#
# FILE: frp.sh
#
# USAGE:
# ./frp.sh --list list.txt -f text.tex
# ./frp.sh --help
#
# DESCRIPTION: Finds the patterns from list in LaTeX source code and replaces them by index entry.
@Kedrigern
Kedrigern / CPP elementary.cpp
Created March 15, 2012 23:47
C++: Basic example of template and std libs.
#include <vector>
#include <string>
#include <iostream>
#include <algorithm>
using namespace std;
template <typename T>
void print(T element) {
cout << element << ' ';
}
@Kedrigern
Kedrigern / load-file.cpp
Last active October 1, 2015 19:57
C++: Loading file example.
// MSVS spouští program ve složce projektu, např:
// C:\Users\keddie\Documents\Visual Studio 2010\Projects\<name>
void print(char c) {
cout << c;
}
int _tmain()
{
ifstream in("in.txt", ifstream::in); // V MSVS se aplikace spousti v hlavni slozce aplikace
@Kedrigern
Kedrigern / ss.sh
Created April 3, 2012 17:45
BASH: Sorted files from gived dirs by file's sufixes. And it is little bit complicated than just copy (for example see arg LIMIT etc.).
#!/bin/bash
# Author: Ondřej Profant, 2012
# Email: ondrej.profant <> gmail.com
# Licence: GPL
# Sorted files from gived dirs by file's sufixes. And it is little bit complicated than just copy (for example see arg LIMIT etc.).
# I use it as final step after PhotoRec recovery app.
# Sorry for Czech texts.
# TODO:
# -- cmd args
# -- clean code
@Kedrigern
Kedrigern / cleanDir.sh
Created September 8, 2012 22:20
Utility to clean/sort huge directories. For example for move all preview images (small files) from dir to another dir.
#/bin/bash
# Author: Ondřej Profant, 2012
# Mail: ondrej.profant <> gmail.com
# Licence: GPL
# Utility to clean/sort huge directories. For example for move all preview images (small files) from dir to another dir.
LICENCE=GPL
VERSION=0.1
DEFAULT_LIMIT=$((10 << 10)); #10kb
function help() {
@Kedrigern
Kedrigern / zapliner.pas
Created October 21, 2012 16:35
Převod čísel na slovní vyjádření a obráceně.
{
# Copyright 2008 Ondřej "Kedrigern" Profant < ondrej.profant (*) 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 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@Kedrigern
Kedrigern / Nejcastejsi.cs
Last active October 11, 2015 22:17
Zadání vypadalo: Čtěte vstupní textový soubor text.in a pro dvacet nejčetnějších slov v něm určete jejich četnost. Tato nejčetnější slova spolu s jejich četnostmi zapište na výstup v pořadí podle klesající četnosti. Pokud mají dvě různá slova shodnou četnost vypište je v abecedním pořadí.
/**
* Author: Ondřej Profant, 2010
* Velmi stará a špatná školní práce...
*/
using System;
using CodEx;
namespace Nejcastejsi
{