Skip to content

Instantly share code, notes, and snippets.

View RenatoUtsch's full-sized avatar

Renato Utsch RenatoUtsch

View GitHub Profile
@RenatoUtsch
RenatoUtsch / benchmark.c
Created November 28, 2012 17:44
C Benchmark function
/*
* Implementation of the benchmark tool.
*/
#include "benchmark.h"
#ifndef __cplusplus
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@RenatoUtsch
RenatoUtsch / stack.c
Created November 28, 2012 17:42
C Stack implementation
#include <stdlib.h>
#include <string.h>
#include "stack.h"
typedef struct StackNode {
StackItem item; /** The data of this node. **/
struct StackNode *next; /** The next node (the one below the top). **/
} StackNode;
struct Stack {
@RenatoUtsch
RenatoUtsch / FindMYSQL.cmake
Created January 16, 2012 22:17
Find MySQL with CMake.
# - Try to find MySQL.
# Once done this will define:
# MYSQL_FOUND - If false, do not try to use MySQL.
# MYSQL_INCLUDE_DIRS - Where to find mysql.h, etc.
# MYSQL_LIBRARIES - The libraries to link against.
# MYSQL_VERSION_STRING - Version in a string of MySQL.
#
# Created by RenatoUtsch based on eAthena implementation.
#
# Please note that this module only supports Windows and Linux officially, but
@RenatoUtsch
RenatoUtsch / template.tex
Last active April 15, 2020 12:30
Modern barebones template for LuaLaTeX and BibLaTeX
\documentclass[12pt]{article}
% Encoding
\usepackage{fontspec}
\usepackage{polyglossia}
\usepackage{csquotes}
\setdefaultlanguage{english}
% Formatting
\usepackage{fullpage}
@RenatoUtsch
RenatoUtsch / convert.sh
Last active April 8, 2018 12:04
Scale, re-encode and add hardsubs to video files using ffmpeg
#!/bin/bash
# Args: ./convert.sh <file glob> <output folder>
# Don't forget to escape the wildcards used in the file glob.
#
# This is a bash script I wrote to convert my high-quality videos to
# lower-quality ones that can be played in my car's player. As it
# (unfortunately) doesn't support softsubs, I also have to encode hardsubs into
# the videos. The only format supported by the player is mp4, so I always convert
# to that by default.
#
@RenatoUtsch
RenatoUtsch / gist:6160850
Last active December 20, 2015 16:19
Bug bizarro
inline bool isNondigit(int digit)
{
if(digit == 'ç')
return true;
else
return false;
}
void func()
{
@RenatoUtsch
RenatoUtsch / c_stack_test.c
Created November 28, 2012 17:46
C Stack file loading test
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "benchmark/benchmark.h"
#include "c/stack.h"
void test_func(void *data, size_t numBytes)
{
Stack *stack = stackCreate();
char *testData = (char *) data, *p;
@RenatoUtsch
RenatoUtsch / cpp_stack_test.cpp
Created November 28, 2012 17:56
C++ STL Stack file loading test
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <stack>
#include "benchmark/benchmark.h"
void test_func(void *data, size_t numBytes)
{
std::stack<char> myStack;
char *testData = (char *) data, *p;
/**
* Calls the functions from the behaviors in order and then the function
* from the element, if it exists.
*/
_inheritanceCall: function(name) {
var args = arguments.slice(1);
for(b in this.behaviors) {
b[name].apply(this, args);
}
// Print an unsigned byte (8 bits) in binary digits.
void print_accu(unsigned char accu) {
int i, j;
for(i = 0x80, j = 0; j < 8; i /= 2)
putchar('0' + ((accu & i) >> (7 - j++)));
}