Skip to content

Instantly share code, notes, and snippets.

Avatar

RNDr. Simon Toth HappyCerberus

View GitHub Profile
View log.txt
==================
WARNING: ThreadSanitizer: data race (pid=9616)
Read of size 8 at 0x556bf9a5ab58 by thread T4:
#0 git_pool__system_page_size external/libgit2/src/pool.c:28 (demo+0x6a932)
#1 git_pool_init external/libgit2/src/pool.c:47 (demo+0x6aa4f)
#2 git_sortedcache_new external/libgit2/src/sortedcache.c:28 (demo+0x98769)
#3 git_refdb_backend_fs external/libgit2/src/refdb_fs.c:2152 (demo+0x754b2)
#4 git_refdb_open external/libgit2/src/refdb.c:49 (demo+0x6d201)
#5 git_repository_refdb__weakptr external/libgit2/src/repository.c:1152 (demo+0x9252e)
#6 git_reference_lookup_resolved external/libgit2/src/refs.c:237 (demo+0x7bf5e)
View gist:cd9a730e40d0c8380692e832f3b900ce
# googleapis
http_archive(
name = "com_google_googleapis",
sha256 = "0744d1a1834ab350126b12ebe2b4bb1c8feb5883bd1ba0a6e876cb741d569994",
strip_prefix = "googleapis-bcc476396e799806d3355e87246c6becf6250a70",
urls = ["https://github.com/googleapis/googleapis/archive/bcc476396e799806d3355e87246c6becf6250a70.tar.gz"],
)
load("@com_google_googleapis//:repository_rules.bzl", "switched_rules_by_language")
switched_rules_by_language(
View test.cpp
#include <cmath>
#include <iostream>
using namespace std;
template <int value> struct Test { int test() { return value; } };
template <> struct Test<0> { int test() { return 0; } };
int main()
{
Test<static_cast<int>(floor(0.5))> a;
@HappyCerberus
HappyCerberus / FastLineReader.cpp
Created Mar 31, 2015
Fast line-by-line file parser
View FastLineReader.cpp
#include "FastLineReader.h"
// POSIX
#include <sys/types.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
View static.cpp
#include <iostream>
using namespace std;
struct A
{
int p_value;
void print() { cout << "Value = \"" << p_value << "\"." << endl; }
};
template < typename T >
View out.dump
simon@lenovo:~/repos/teaching/examples/PB161> ./a.out
dry run 499994165
Accumulate runtime 28169000 - 499994165
Manual sum runtime 44949000 - 499994165
simon@lenovo:~/repos/teaching/examples/PB161> ./a.out
dry run 499996968
Accumulate runtime 32467000 - 499996968
Manual sum runtime 44659000 - 499996968
simon@lenovo:~/repos/teaching/examples/PB161> ./a.out
dry run 500024233
@HappyCerberus
HappyCerberus / main.cpp
Created Oct 23, 2012
BMP image format writing helper
View main.cpp
#include <vector>
#include <cstdint>
#include <iostream>
using namespace std;
class BitmapWriter
{
public:
struct RGB { unsigned char red; unsigned char green; unsigned char blue;
@HappyCerberus
HappyCerberus / main.cpp
Created Oct 22, 2012
Tree data structure - first part of implementation
View main.cpp
#include "node.h"
#include "nodeiter.h"
#include <iostream>
#include <memory>
#include <list>
using namespace std;
int main()
{
View compile.sh
g++ -std=c++11 -pedantic -Wall -Wextra -ggdb3 -D_GLIBCXX_USE_NANOSLEEP -D_GLIBCXX_USE_SCHED_YIELD -lpthread main.cpp node.cpp
View formula.c
#include <stdio.h>
int main()
{
int a = 8000;
double b;
b = (((float)a/65535)-1)/0.245;
printf("a = %d\n",a);
printf("((a/65535)-1)/0.245 = %f\n",b);