Skip to content

Instantly share code, notes, and snippets.

View SaveTheRbtz's full-sized avatar

Alexey Ivanov SaveTheRbtz

View GitHub Profile
#!/bin/sh
#
# Simple utility to check that all *.crt files match corresponding *.key's
#
for FILE in *.crt; do
CERT="$FILE"
KEY="${FILE%crt}key"
$ numactl --membind=1 --cpunodebind=1 dd if=/dev/zero of=/dev/null bs=64M count=100
100+0 records in
100+0 records out
6710886400 bytes (6.7 GB) copied, 0.911091 s, 7.4 GB/s
$ numactl --membind=0 --cpunodebind=1 dd if=/dev/zero of=/dev/null bs=64M count=100
100+0 records in
100+0 records out
6710886400 bytes (6.7 GB) copied, 1.28833 s, 5.2 GB/s
@SaveTheRbtz
SaveTheRbtz / fact_eval1.py
Last active August 29, 2015 13:56
python factorials
from itertools import imap
fact_eval1 = lambda n: eval("*".join(imap(str, xrange(1, n + 1)))) if n > 1 else 1
#!/bin/bash
#
# Copyright (c) 2015, Intel Corporation
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
static const struct ixgbe_info *ixgbe_info_tbl[] = {
[board_82598] = &ixgbe_82598_info,
[board_82599] = &ixgbe_82599_info,
[board_X540] = &ixgbe_X540_info,
};
/* ixgbe_pci_tbl - PCI Device ID Table
*
* Wildcard entries (PCI_ANY_ID) should come last
* Last entry must be all 0s
@SaveTheRbtz
SaveTheRbtz / libowfat-0.29_CAS.h.diff
Created October 1, 2013 21:54
Do not return value from `void` function
diff --git a/libowfat-0.29/CAS.h b/libowfat-0.29/CAS.h
index 27b3219..1308050 100644
--- a/libowfat-0.29/CAS.h
+++ b/libowfat-0.29/CAS.h
@@ -53,7 +53,7 @@ static inline size_t atomic_add_return(size_t* x,size_t val) {
/* *x += val; */
static inline void atomic_add(size_t* x,size_t val) {
#ifdef USE_BUILTINS
- return __sync_add_and_fetch(x,val);
+ __sync_add_and_fetch(x,val);
#include <sys/mman.h>
#include <err.h>
#include <fcntl.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#define MAP_NAM "/var/tmp/test_map_0"
@SaveTheRbtz
SaveTheRbtz / dst00_mail_grep.txt
Last active December 17, 2015 06:39
Yandex FreeBSD kernel panic stats. Feb/Apr.
$ grep -h Subject /place/mail/textdumps.2013-03-* | perl -pe 's/Subject: \[sendcore\] panic on //' | sort -u | grep ^ws[0-9] | perl -pe 's/ws[0-9]+-[0-9]+: //' | perl -pe 's/0x[0-f]+/<pointer>/g' | sort | uniq -c | sort -n
1 NMI indicates hardware failure
1 ffs_write: type <pointer> 0 (0,161)
1 initiate_write_inodeblock_ufs2: already started
2 Bad effnlink fip <pointer>, fdp <pointer>, tdp <pointer>
4 softdep_setup_inomapdep: dependency <pointer> for newinode already exists
5 handle_written_inodeblock: live inodedep <pointer>
5 softdep_deallocate_dependencies: unrecovered I/O error
6 ffs_blkfree_cg: freeing free frag
6 spin lock held too long
@SaveTheRbtz
SaveTheRbtz / Makefile
Last active January 12, 2017 10:14
Measure performance of qsort(3) vs std::sort()
CXX = $${CXX:-c++}
CXXFLAGS = -std=c++11 -O3
CC = $${CC:-cc}
CFLAGS = -O3
all: sort_cpp sort_c test
sort_cpp: sort.cpp
$(CXX) $(CXXFLAGS) $^ -o $@
@SaveTheRbtz
SaveTheRbtz / replay_logs.py
Created March 11, 2013 12:44
Simple multiprocess log re-player for elliptics proxy
#!/usr/bin/env python3
#
# Simple multiprocess log re-player for elliptics proxy
#
from hashlib import sha256
from time import sleep
from urllib import request
from urllib.error import HTTPError