Skip to content

Instantly share code, notes, and snippets.

View robin-thoni's full-sized avatar

Robin Thoni robin-thoni

View GitHub Profile
@vkobel
vkobel / underscoreCase.cs
Created August 7, 2014 14:22
Simple C# extension method to convert a camel case string to underscore notation without any regex
public static class ExtensionMethods {
public static string ToUnderscoreCase(this string str) {
return string.Concat(str.Select((x, i) => i > 0 && char.IsUpper(x) ? "_" + x.ToString() : x.ToString())).ToLower();
}
}
@nevkontakte
nevkontakte / CLion_Ninja.md
Last active July 10, 2024 09:02
Ninja support for CLion IDE

Ninja support for CLion IDE

This script enables Ninja-powered builds in CLion IDE by wrapping around CMake, which it uses. See my blog post for details.

Disclaimer

This script is provided AS IS with no guarantees given or responsibilities taken by the author. This script relies on undocumented features of CLion IDE and may lead to instability of build and/or IDE. Use it on your own risk under WTFPL terms.

@Sjd-Risca
Sjd-Risca / Jinja2 saltstack: dictionary merging
Created April 19, 2016 09:11
For Saltstack with jinja rendering: deep merge a dictionary into a first one
{%- macro deep_merge(a, b) %}
{%- for k,v in b.iteritems() %}
{%- if v is string or v is number %}
{%- do a.update({ k: v }) %}
{%- elif v is not mapping %}
{%- if a[k] is not defined %}
{%- do a.update({ k: v }) %}
{%- elif a[k] is iterable and a[k] is not mapping and a[k] is not string %}
{%- do a.update({ k: v|list + a[k]|list}) %}
{%- else %}
@jkullick
jkullick / raspberry-pi-chroot-armv7-qemu.md
Last active March 24, 2024 14:36
Chroot into Raspberry Pi ARMv7 Image with Qemu
# install dependecies
apt-get install qemu qemu-user-static binfmt-support

# download raspbian image
wget https://downloads.raspberrypi.org/raspbian_latest

# extract raspbian image
unzip raspbian_latest
@sczizzo
sczizzo / example.muxt
Created June 9, 2017 03:12
Sketching out a tmux layout utility
+------------+
| | 2 |
| |--------|
| 1 | 3 |4 |
| |--------|
| | 5 |
+------------+
+------------+
| 6 | 0 |
@apsun
apsun / hax.c
Last active October 21, 2024 19:19
Hook main() using LD_PRELOAD
/*
* Hook main() using LD_PRELOAD, because why not?
* Obviously, this code is not portable. Use at your own risk.
*
* Compile using 'gcc hax.c -o hax.so -fPIC -shared -ldl'
* Then run your program as 'LD_PRELOAD=$PWD/hax.so ./a.out'
*/
#define _GNU_SOURCE
#include <stdio.h>
@waltner
waltner / cuda_indexing.cu
Created October 6, 2017 05:20
CUDA indexing
// 1D grid of 1D blocks
__device__ int getGlobalIdx_1D_1D()
{
return blockIdx.x *blockDim.x + threadIdx.x;
}
// 1D grid of 2D blocks
__device__ int getGlobalIdx_1D_2D()
{
return blockIdx.x * blockDim.x * blockDim.y + threadIdx.y * blockDim.x + threadIdx.x;
@htruong
htruong / raspberry-pi-chroot-armv7-qemu.md
Last active July 22, 2024 14:36 — forked from jkullick/raspberry-pi-chroot-armv7-qemu.md
Chroot into Raspberry Pi ARMv7 Image with Qemu
# raspbian stretch lite on ubuntu

### You can write the raspbian image onto the sd card,
# boot the pi so it expands the fs, then plug back to your laptop/desktop
# and chroot to it with my script 
# https://gist.github.com/htruong/7df502fb60268eeee5bca21ef3e436eb
# sudo ./chroot-to-pi.sh /dev/sdb
# I found it to be much less of a pain in the ass and more reliable
# than doing the kpartx thing
@darconeous
darconeous / tesla-key-card-protocol.md
Last active November 8, 2024 21:21
Tesla Key Card Protocol

Tesla Key Card Protocol

Researched by Robert Quattlebaum [email protected].

Last updated 2020-02-03.

Image of Tesla Key Card Image of Tesla Model 3 Key Fob

@bashenk
bashenk / AndroidDeviceEnrollmentQRCreation.md
Last active October 31, 2024 12:40
Creating a QR Code for Android Device Enrollment