Skip to content

Instantly share code, notes, and snippets.

View jiridanek's full-sized avatar
🍻

Jiri Daněk jiridanek

🍻
View GitHub Profile
@bemasher
bemasher / Castle.xml
Created September 18, 2011 03:46
Example of parsing xml in golang.
<?xml version="1.0" encoding="UTF-8" ?>
<Data>
<Series>
<id>83462</id>
<Actors>|Nathan Fillion|Stana Katic|Molly C. Quinn|Jon Huertas|Seamus Dever|Tamala Jones|Susan Sullivan|Ruben Santiago-Hudson|Monet Mazur|</Actors>
<Airs_DayOfWeek>Monday</Airs_DayOfWeek>
<Airs_Time>10:00 PM</Airs_Time>
<ContentRating>TV-PG</ContentRating>
<FirstAired>2009-03-09</FirstAired>
<Genre>|Drama|</Genre>
@hellerbarde
hellerbarde / latency.markdown
Created May 31, 2012 13:16 — forked from jboner/latency.txt
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs

@andreygursky
andreygursky / Makefile
Created June 21, 2012 22:11
simple test for memory allocation for global variables in dynamically loaded lib
CC=gcc
CFLAGS=-Wall -g
all: libdl_func.so.1.0.0 test_dl
libdl_func.so.1.0.0: dl_func.o
rm -f libdl_func.so
rm -f libdl_func.so.1
$(CC) -o $@ $^ -shared -Wl,-soname,libdl_func.so.1
ln -s libdl_func.so.1.0.0 libdl_func.so
@chrislongo
chrislongo / gdbinit
Created August 14, 2012 17:50 — forked from CocoaBeans/gdbinit
.gdbinit - A user-friendly gdb configuration file
# INSTALL INSTRUCTIONS: save as ~/.gdbinit
#
# DESCRIPTION: A user-friendly gdb configuration file.
#
# REVISION : 7.3 (16/04/2010)
#
# CONTRIBUTORS: mammon_, elaine, pusillus, mong, zhang le, l0kit,
# truthix the cyberpunk, fG!, gln
#
# FEEDBACK: https://www.reverse-engineering.net
@ocornut
ocornut / printf_tips.cpp
Last active March 24, 2023 11:23
C/C++ tips for using printf-style functions
// C/C++ tips for using printf-style functions
// Lots of manipulation can be expressed simply and fast with printf-style formatting
// Also helps reducing the number of temporaries, memory allocations or copies
// ( If you are looking for a simple C++ string class that is printf-friendly and not heap-abusive,
// I've been using this one: https://github.com/ocornut/Str )
// If you are interested in a FASTER implementation of sprintf functions, see stb_sprintf.h
// https://github.com/nothings/stb/blob/master/stb_sprintf.h
// How to concatenate non-zero terminated strings
@yowu
yowu / HttpProxy.go
Last active November 16, 2024 13:40
A simple HTTP proxy by Golang
package main
import (
"flag"
"io"
"log"
"net"
"net/http"
"strings"
)
@cabbageshop
cabbageshop / AdminDeployment.xml
Created September 12, 2015 09:23
VS2015 AdminDeployment.xml : The stuff that I use
<?xml version="1.0" encoding="utf-8"?>
<AdminDeploymentCustomizations xmlns="http://schemas.microsoft.com/wix/2011/AdminDeployment">
<BundleCustomizations TargetDir="default" NoWeb="default" />
<SelectableItemCustomizations>
<SelectableItemCustomization Id="VC_MFC_Libraries" Hidden="no" Selected="no" />
<SelectableItemCustomization Id="SQL" Hidden="no" Selected="yes" />
<SelectableItemCustomization Id="WebTools" Hidden="no" Selected="yes" />
<SelectableItemCustomization Id="MDDCPlusPlus" Hidden="no" Selected="no" />
<SelectableItemCustomization Id="MDDJS" Hidden="no" Selected="no" />
<SelectableItemCustomization Id="SilverLight_Developer_Kit" Hidden="no" Selected="no" />
@peterhurford
peterhurford / pytest-fixture-modularization.md
Created July 28, 2016 15:48
How to modularize your py.test fixtures

Using py.test is great and the support for test fixtures is pretty awesome. However, in order to share your fixtures across your entire module, py.test suggests you define all your fixtures within one single conftest.py file. This is impractical if you have a large quantity of fixtures -- for better organization and readibility, you would much rather define your fixtures across multiple, well-named files. But how do you do that? ...No one on the internet seemed to know.

Turns out, however, you can define fixtures in individual files like this:

tests/fixtures/add.py

import pytest

@pytest.fixture
@rambabusaravanan
rambabusaravanan / .gitconfig
Last active July 12, 2024 07:14
Git Diff and Merge Tool - IntelliJ IDEA
# Linux
# add the following to "~/.gitconfig" file
[merge]
tool = intellij
[mergetool "intellij"]
cmd = /usr/local/bin/idea merge $(cd $(dirname "$LOCAL") && pwd)/$(basename "$LOCAL") $(cd $(dirname "$REMOTE") && pwd)/$(basename "$REMOTE") $(cd $(dirname "$BASE") && pwd)/$(basename "$BASE") $(cd $(dirname "$MERGED") && pwd)/$(basename "$MERGED")
trustExitCode = true
[diff]
@mbinna
mbinna / effective_modern_cmake.md
Last active November 13, 2024 23:24
Effective Modern CMake

Effective Modern CMake

Getting Started

For a brief user-level introduction to CMake, watch C++ Weekly, Episode 78, Intro to CMake by Jason Turner. LLVM’s CMake Primer provides a good high-level introduction to the CMake syntax. Go read it now.

After that, watch Mathieu Ropert’s CppCon 2017 talk Using Modern CMake Patterns to Enforce a Good Modular Design (slides). It provides a thorough explanation of what modern CMake is and why it is so much better than “old school” CMake. The modular design ideas in this talk are based on the book [Large-Scale C++ Software Design](https://www.amazon.de/Large-Scale-Soft