Skip to content

Instantly share code, notes, and snippets.

View Caellian's full-sized avatar

Tin Švagelj Caellian

View GitHub Profile
@Caellian
Caellian / fix_includes.py
Last active April 29, 2020 17:03
Include Fixer
#!/bin/env python3
import os
import re
import tempfile
import shutil
RootIncludeDir = "/home/asger/Software/Ogre/ogre-next/OgreMain/include" # Root of include directory
TryRelative = ['.', 'Deprecated'] # Alternative lookup paths for includes. Relative to RootIncludeDir
@Caellian
Caellian / update.sh
Last active January 19, 2024 12:51
Emoji list update
#!/bin/env sh
function check_version() {
curl -s "https://unicode.org/Public/cldr/$1/" | grep -o "core.zip<" >/dev/null && echo 0 || echo 1
}
function cldr_versions() {
curl -s "https://unicode.org/Public/cldr/" | grep -oP "(?<=<li><a href=\")\d+(\.\d+)*" | tac
}
@Caellian
Caellian / diff.gradle
Last active October 9, 2019 12:35
Minecraft Project gradle files.
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath "io.github.java-diff-utils:java-diff-utils:4.0"
}
}
@Caellian
Caellian / vulkanValidificationLayers.cpp
Last active January 28, 2019 01:35
Proper validification layer handling.
#define GLFW_INCLUDE_VULKAN
#include <GLFW/glfw3.h>
#include <iostream>
#include <stdexcept>
#include <functional>
#include <cstdlib>
#include <vector>
#include <cstring>
@Caellian
Caellian / manhattan.cpp
Last active December 6, 2018 21:08
MIT - Find which point is furthest from others.
#include <iostream>
#include <map>
#include <vector>
#include <utility>
#include <cmath>
#include <cstdlib>
typedef struct {
int posX, posY;
int name;
@Caellian
Caellian / properInput.cpp
Last active March 18, 2019 00:58
Fixed number input.
#include <iostream>
#include <string>
#include <sstream>
template <class T>
void readInto(T *var, const std::string &inputMessage, const std::string &errorMessage) {
std::string input;
while (true) {
std::cout << inputMessage;
#include <iostream>
using namespace std;
int main() {
int unos;
cout<<"Unesi broj u intervalu <2,10>: ";
cin>>unos;
while(unos<=2 || unos>=10) {
@Caellian
Caellian / nkd.cpp
Created October 27, 2018 14:43
NKD
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
std::vector<std::string> nkd;
int k, n;
int main()
{
@Caellian
Caellian / Submatrix.scala
Created September 13, 2018 13:00
Example of dense and uncommented code.
/**
* Creates a new matrix without specified rows & columns.
*
* @param deletedRows rows to exclude from submatrix.
* @param deletedColumns columns to exclude from submatrix.
* @return defined submatrix.
*/
def submatrix(deletedRows: Array[Int], deletedColumns: Array[Int]): MatrixF = {
val result = Array.ofDim[Float](rowCount - deletedRows.count(rowCount >= _), columnCount - deletedColumns.count(columnCount >= _))
data.indices.filterNot(deletedRows contains _ + 1).zipWithIndex.foreach { case (row, i) =>
@Caellian
Caellian / Transpose 2D Array.kt
Last active September 5, 2018 04:20
Kotlin code bits.
inline fun <reified T> Array<Array<T>>.transpose(): Array<Array<T>> {
return Array(this[0].size) { i -> Array (this.size) { j -> this[j][i]} }
}