Skip to content

Instantly share code, notes, and snippets.

View gpakosz's full-sized avatar

Grégory Pakosz gpakosz

View GitHub Profile
@gpakosz
gpakosz / gist:4691383
Created February 1, 2013 13:42
Somewhere between /W4 and /Wall
/Wall /we4013 /wd4820 /we4289 /wd4342 /wd4347 /wd4514 /we4545 /we4546 /we4547 /we4548 /we4549 /we4619 /we4623 /we4625 /we4626 /wd4710 /we4836 /we4905 /we4906 /we4928 /we4946 /wd4986 /wd4350
@gpakosz
gpakosz / gist:4730132
Created February 7, 2013 10:32
suppress Microsoft CRT dialog box
#ifdef _WIN32
int stfuHook(int, char*, int* returnValue)
{
if (returnValue)
*returnValue = 0;
return true;
}
#endif
@gpakosz
gpakosz / compass.rb
Created April 19, 2013 12:59
Better yet hacky Compass / nanoc integration.
def compass_sass_engine_options
fail "configuring Compass with 'relative_assets = true' doesn't make much sense in the context of nanoc" if Compass.configuration.relative_assets?
options = Compass.sass_engine_options
options[:load_paths].each do |x|
class << x
alias _inspect inspect
def inspect
_inspect.gsub(/:0x\h+/, '')
@gpakosz
gpakosz / PackedArray.pp.c
Created August 3, 2013 13:31
Loop unrolling and code generation with self inclusion and preprocessing.
#include "PackedArray.h"
#include <assert.h>
void __PackedArray_pack_1(uint32_t* __restrict out, uint32_t offset, const uint32_t* __restrict in, uint32_t count)
{
uint32_t startBit;
uint32_t packed;
const uint32_t* __restrict end;
@gpakosz
gpakosz / .gitconfig
Created September 26, 2013 10:59
Pretty git log.
[alias]
plog = log --graph --pretty=format:'%Cred%h%Creset %C(cyan)%an%Creset %C(yellow)%d%Creset %s %C(green)(%cr)%Creset' --abbrev-commit
@gpakosz
gpakosz / checkduplicatesymbols.sh
Created October 3, 2013 20:43
./checkduplicatesymbols.sh libFoo.a libBar.a
#!/bin/sh
# exit the script if any statement returns a non-true return value
set -e
# exit the script on dereferencing uninitialised variables
set -o nounset
self=$(basename $0)
origin=$(cd "$(dirname "$0")"; pwd)
" -- tabular settings ----------------------------------------------------------
nnoremap <silent> <Leader>a= :Tabularize /=<CR>
vnoremap <silent> <Leader>a= :Tabularize /=<CR>
nnoremap <silent> <Leader>a: :Tabularize /:\zs<CR>
vnoremap <silent> <Leader>a: :Tabularize /:\zs<CR>
" auto align on pipes
inoremap <silent> <Bar> <Bar><Esc>:call <SID>pipe_align()<CR>a
function! s:pipe_align()
// gcc -O3 -march=native -o simplehashing simplehashing.c
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include <math.h>
#include <string.h>
#include <x86intrin.h>
// https://github.com/php/php-src/blob/PHP-7.1/Zend/zend_string.h#L325
@gpakosz
gpakosz / gist:1128030
Created August 5, 2011 17:22
ARM NEON integer 16x8 dot product
# ------------------------------------------------------------------------------
# int32_t dotProduct_16x8_neon(int16_t const* __restrict u, int8_t const* __restrict v, int32_t size)
.globl _dotProduct_16x8_neon
.private_extern _dotProduct_16x8_neon
.no_dead_strip _dotProduct_16x8_neon
_dotProduct_16x8_neon:
# calling conventions:
#---------------------
@gpakosz
gpakosz / array_length.hpp
Created January 5, 2017 21:46
C++98 array_length
#include <cstddef>
#define array_length(a) sizeof(impl::array_length_requires_array_argument(a))
namespace impl {
template<typename T, size_t N>
char (&array_length_requires_array_argument(T (&)[N]))[N];
}