Skip to content

Instantly share code, notes, and snippets.

@schmidt9
schmidt9 / scale_points_v2.cpp
Created July 15, 2021 15:59
Improved / alternative scaling points algorithm
// first variant https://gist.github.com/schmidt9/534361ab8d504ccd6b92bbd3b2c22acd
/**
1) find hull (bounding) polygon for points
2) calculate centroid for this polygon
3) use centroid as anchor point to scale points
*/
// Hull
@schmidt9
schmidt9 / scale_points.cpp
Last active July 15, 2021 16:06
Scaling points algorithm
// POINT STRUCT
struct Point {
double x = DBL_MAX;
double y = DBL_MAX;
Point() {};
Point(double x, double y) : x{x}, y{y} {}
Point(const std::pair<double, double> &p) : x{p.first}, y{p.second} {};
@schmidt9
schmidt9 / rename_splashes.sh
Last active March 6, 2019 13:25
Rename iOS splash screen files
#!/bin/sh
echo "path: $1"
#check number of args
if [ $# = 0 ]; then
echo "No path to images directory"
exit 1
fi
//
// The MIT License (MIT)
//
// Copyright (c) 2016 Alexander Kormanovsky
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
@schmidt9
schmidt9 / mysql2sqlite.sh
Created September 12, 2016 19:01 — forked from esperlu/mysql2sqlite.sh
MySQL to Sqlite converter
#!/bin/sh
# Converts a mysqldump file into a Sqlite 3 compatible file. It also extracts the MySQL `KEY xxxxx` from the
# CREATE block and create them in separate commands _after_ all the INSERTs.
# Awk is choosen because it's fast and portable. You can use gawk, original awk or even the lightning fast mawk.
# The mysqldump file is traversed only once.
# Usage: $ ./mysql2sqlite mysqldump-opts db-name | sqlite3 database.sqlite
# Example: $ ./mysql2sqlite --no-data -u root -pMySecretPassWord myDbase | sqlite3 database.sqlite