Skip to content

Instantly share code, notes, and snippets.

View carlmartus's full-sized avatar

Martin Sandgren carlmartus

View GitHub Profile
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active May 19, 2024 07:07
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@spion
spion / a-warning.md
Last active March 25, 2024 03:01
C++ versus V8 versus luajit versus C benchmark - (hash) tables

Warning

This benchmark has been misleading for a while. It was originally made to demonstrate how JIT compilers can do all sorts of crazy stuff to your code - especially LuaJIT - and was meant to be a starting point of discussion about what exactly LuaJIT does and how.

As a result, its not indicative of what its performance may be on more realistic data. Differences can be expected because

  1. the text will not consist of hard-coded constants
@zhoukuo
zhoukuo / cost_us.c
Created July 13, 2012 03:21
Calculate the execution time of microseconds
/* use gettimeofday() to calculate the execution time in microseconds */
#include <sys/time.h>
long timecost(void (*dosomething)())
{
struct timeval start, end;
long cost;
gettimeofday(&start, NULL);
dosomething();
gettimeofday(&end, NULL);
@arq5x
arq5x / test.sh
Last active November 30, 2023 12:50
Compress and then Decompress a string with zlib.
# compile
$ g++ zlib-example.cpp -lz -o zlib-example
# run
$ ./zlib-example
Uncompressed size is: 36
Uncompressed string is: Hello Hello Hello Hello Hello Hello!
----------
@dashed
dashed / github-pandoc.css
Created September 26, 2013 13:42
GitHub-like CSS for pandoc standalone HTML files (perfect for HTML5 output). Based on Marked.app's GitHub CSS. Added normalize.css (v2.1.3) in the prior to GitHub css.
/*! normalize.css v2.1.3 | MIT License | git.io/normalize */
/* ==========================================================================
HTML5 display definitions
========================================================================== */
/**
* Correct `block` display not defined in IE 8/9.
*/
@mygnu
mygnu / libxml_parsig.c
Created January 27, 2014 01:22
libxml2 test
/* Code: */
#include <libxml/parser.h>
#include <libxml/xpath.h>
#include <stdio.h>
xmlDocPtr
getdoc (char *docname)
{
xmlDocPtr doc;
doc = xmlParseFile(docname);

Systemd

sample.service file you have to copy it to /etc/systemd/system

Set it to auto start

sudo systemctl enable sample.service

Troubleshoot

@PurpleBooth
PurpleBooth / README-Template.md
Last active May 19, 2024 06:34
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@lifthrasiir
lifthrasiir / why-large.md
Last active September 27, 2017 14:17
Why is a Rust executable large? (DRAFT)

Suppose that you are a programmer primarily working with compiled languages. Somehow you’ve got tired of those languages, there may be multiple valid reasons, and heard of a trendy new programming language called Rust. Looking at some webpages and the official forum, it looks great and you decides to try it out. It seems that Rust was a bit cumbersome to install in the past, but thanks to rustup the problem seems gone by now. Cargo seems to be great, so you follow the first sections of the Book and put a small greeting to the new language:

fn main() {
    println!("Hello, world!");
}

Amazingly cargo run runs without a hassle. It is kind of a miracle as you used to configure the build script, Makefile, projects or whatever before building things. Impressed, you realize that the executable is available in target/debug/hello. You instinctively type ls -al out (or is it dir?) and

@VadimBrodsky
VadimBrodsky / install-unrar-nonfree-raspbian.sh
Created October 8, 2016 18:30
Get Unrar Nonfree on Raspbian for the Raspberry PI
# As per this guide -- http://raspberrypi.stackexchange.com/questions/3617/how-to-install-unrar-nonfree#3618
# Uninstall unrar-free.
sudo apt-get remove unrar-free
# Make sure you have a source repository by editing /etc/apt/sources.list.
cat /etc/apt/sources.list
# Sync the apt database.
sudo apt-get update