Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View Kedrigern's full-sized avatar

Ondřej Profant Kedrigern

View GitHub Profile
@Kedrigern
Kedrigern / select.sql
Created March 29, 2014 22:54
DV view for data
SELECT *, md5(data) as md5, TRUNCATE(LENGTH(`data`)/1000,1) as "SIZE (kB)"
FROM `image`
@Kedrigern
Kedrigern / my_array_splice.php
Created October 27, 2014 15:38
my_array_splice
#!/usr/bin/php
<?php
class A {
public $a;
public function __construct($a) {
$this->a = $a;
}
@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 / 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 / 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 / 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 / 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 / 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
{