Skip to content

Instantly share code, notes, and snippets.

View zao's full-sized avatar

Lars Viklund zao

View GitHub Profile
@zao
zao / adler32.py
Created February 3, 2014 12:53
Python implementation of streaming Adler32 checksum
#!/usr/bin/env python
import io,sys,zlib
for filename in sys.argv[1:]:
try:
file = io.open(filename,'rb')
buf = bytearray(1024*128)
part_sum = 1;
while True:
n = file.readinto(buf)
@zao
zao / adler32-24.py
Created February 3, 2014 13:03
Python 2.4 implementation of Adler32 checksum
#!/usr/bin/env python
import sys,zlib
for filename in sys.argv[1:]:
try:
file = open(filename,'rb')
part_sum = 1;
while True:
buf = file.read(1024*128)
n = len(buf)
@zao
zao / gist:8972375
Created February 13, 2014 09:42
hpx cmake on WIndows w/ Windows-style BOOST_ROOT
c:\Users\Lars\bounce\build\hpx-git-vc110>cmake -G "Visual Studio 11 Win64" ..\..
\hpx-git -DCMAKE_BUILD_TYPE=Debug -DBOOST_ROOT=C:\users\Lars\local\boost-1.54.0\
v110
-- The CXX compiler identification is MSVC 17.0.61030.0
-- The C compiler identification is MSVC 17.0.61030.0
-- Check for working CXX compiler using: Visual Studio 11 Win64
-- Check for working CXX compiler using: Visual Studio 11 Win64 -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working C compiler using: Visual Studio 11 Win64
@zao
zao / phx-new.cc
Created April 17, 2014 14:21
Phoenix new
#include <boost/phoenix.hpp>
struct C {
};
struct B {
C foo() { C c; return c; }
};
struct A {
22:46:13 lars@t-mn01:~/Public/ram_bench (git:master:eb5bd92)
∫ pathcc -std=c99 -O3 -o list_traversal list_traversal.c
list_traversal.c:95:59: warning: format specifies type 'unsigned long long' but the argument has type 'unsigned long' [-Wformat]
printf("%llu %f # (N=%llu, reps=%llu) %llu/%llu\n", N*sizeof(Node), ans, N, reps, ei-min+1, max-min+1);
~~~~ ^~~~~~~~~~~~~~
%lu
list_traversal.c:95:80: warning: format specifies type 'unsigned long long' but the argument has type 'Int' (aka 'unsigned long') [-Wformat]
printf("%llu %f # (N=%llu, reps=%llu) %llu/%llu\n", N*sizeof(Node), ans, N, reps, ei-min+1, max-min+1);
~~~~ ^
%lu
1>------ Build started: Project: ZERO_CHECK, Configuration: Debug x64 ------
2>------ Skipped Build: Project: RUN_TESTS, Configuration: Debug x64 ------
2>Project not selected to build for this solution configuration
3>------ Skipped Build: Project: Continuous, Configuration: Debug x64 ------
3>Project not selected to build for this solution configuration
4>------ Build started: Project: ALL_BUILD, Configuration: Debug x64 ------
4> Build all projects
5>------ Build started: Project: broadcast_apply_test_exe, Configuration: Debug x64 ------
5> Creating library C:/Users/Lars/bounce/build/hpx-git-v110-x64/tests/unit/lcos/DEBUG/broadcast_apply_test.lib and object C:/Users/Lars/bounce/build/hpx-git-v110-x64/tests/unit/lcos/DEBUG/broadcast_apply_test.exp
5>broadcast_apply.obj : error LNK2019: unresolved external symbol "public: static int __cdecl hpx::traits::component_type_database<struct hpx::components::server::plain_function<struct hpx::actions::plain_action4<struct hpx::lcos::detail::broadcast_with_ind
@zao
zao / HermiteSpline.hh
Created June 1, 2014 15:47
Hermite splines
#pragma once
#include "math/OrientationMapping.h"
#include "util/Numeric.h"
#include "util/PaddedVector.h"
namespace math
{
template <size_t A, size_t B>
float H(float t);
@zao
zao / winless_win32.c
Created July 8, 2014 08:25
winless on Windows
#define NOMINMAX 1
#include <Windows.h>
#include <GL/gl.h>
#include <stdio.h>
#pragma comment (lib, "opengl32.lib")
typedef struct WindowData
{
HDC dc;
@zao
zao / endian-49866e07842e4b2b9c2d8e76b2c7fb3a61a1bdd2-fbsd10-sparc64-gcc421.txt
Created August 15, 2014 17:31
endian-49866e07842e4b2b9c2d8e76b2c7fb3a61a1bdd2-fbsd10-sparc64-gcc421.txt
Performing configuration checks
- symlinks supported : yes
...patience...
...found 334 targets...
...updating 31 targets...
common.mkdir ../../../bin.v2/libs
common.mkdir ../../../bin.v2/libs/endian
common.mkdir ../../../bin.v2/libs/endian/test
common.mkdir ../../../bin.v2/libs/endian/test/endian_test.test
inline void lv_range_strip_comment(lv_range* r) {
char* p = memchr(r->from, '#', r->to - r->from);
if (p) {
r->to = p;
}
}