Skip to content

Instantly share code, notes, and snippets.

View mirekfranc's full-sized avatar
🌚
Rien

Miroslav Franc mirekfranc

🌚
Rien
  • Prague, Czech Republic
View GitHub Profile
#!/usr/bin/python3
import os
import bpy
DIRNAME = os.path.dirname(os.path.realpath(__file__))
FILES = [f for f in os.listdir(DIRNAME) if os.path.isfile(os.path.join(DIRNAME, f)) and f.endswith(('blend'))]
NEW_FILES_DIR = os.path.join(DIRNAME, 'ok')
os.mkdir(NEW_FILES_DIR)
@mirekfranc
mirekfranc / foo.sh
Last active May 20, 2019 19:35
macOS // facepalm
abspath="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")"; pwd)"
echo $abspath
@mirekfranc
mirekfranc / cool.py
Created May 5, 2019 17:15
Dist usage from python
import os
import shutil
total, used, free = shutil.disk_usage('.')
print(total, used, free / (1024 * 1024 * 1024))
for i in *.jpg; do convert $i \( mask.png -channel a -separate +channel \) -compose copy_opacity -composite ${i%jpg}png;done
int typedef Int, *pInt, **ppInt;
unsigned typedef char UChar;
int main()
{
UChar u = 25 * sizeof(UChar);
Int a = 17 * sizeof(UChar);
pInt b = &a;
ppInt c = &b;
return 0[c][0] + u;
@mirekfranc
mirekfranc / variadic_template.cc
Created June 7, 2018 15:37
fooing around with variadic templates...
#include <unordered_map>
#include <string>
#include <iostream>
struct foo;
struct bar;
struct baz;
template<typename T> struct uhm;
#include <variant>
#include <iostream>
#include <ios>
#define print(x) do { std::cout << #x << ": " << std::boolalpha << (x) << std::endl; } while (0)
struct IsEmptyVisitor
{
template<typename T>
bool operator()(const T&) const { return false; }
@mirekfranc
mirekfranc / CMakeLists.txt
Created May 4, 2018 15:20
compile each object file only once...
cmake_minimum_required(VERSION 3.5)
find_program(CCACHE_PROGRAM ccache)
if(CCACHE_PROGRAM)
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE_PROGRAM}")
endif()
set(program_name an_experiment)
project(${program_name} CXX)
@mirekfranc
mirekfranc / char-type.cc
Created April 27, 2018 13:30
char != signed char && char != unsigned char
// x86_64-redhat-linux
#include <iostream>
template<typename T> struct foo;
#ifndef NO_CHAR
template<> struct foo<char> { void operator()() { std::cout << "char" << std::endl;} };
#endif
template<> struct foo<unsigned char> { void operator()() { std::cout << "unsigned char" << std::endl;} };
@mirekfranc
mirekfranc / overriding.py
Created October 4, 2017 12:21
Python overriding
class Foo(object):
def fce(self):
print "foo"
class Bar(Foo):
def fce(self):
super(Bar, self).fce() # c'est nécessaire
print "bar"
a = Bar()