Skip to content

Instantly share code, notes, and snippets.

@Mr-Andersen
Mr-Andersen / Variant.cpp
Last active August 1, 2024 08:18
Implementation of tagged union without typeinfo library. Beware: this code contains a dozen undefined behaviours and a dozen more. Use only as inspiration.
#include <iostream>
// get_type<i, Ts...>::type -> Ts[i] (Compile error of i >= length(Ts))
template<size_t i, typename T, typename... Ts>
struct get_type {
typedef typename get_type<i - 1, Ts...>::type type;
};
template<typename T, typename... Ts>
@patriknyblad
patriknyblad / xcrun_simctl_cheatsheet.md
Last active July 7, 2025 20:00
iOS Simulator Terminal Commands `$ xcrun simctl`

Managing iOS Simulators

List all simulators created

$ xcrun simctl list --json

Delete old and unavailable simulators

$ xcrun simctl delete unavailable
@MediumOne
MediumOne / IntentLogger.java
Created September 21, 2017 10:46
Code to print/log contents of an Intent in Android
package com.example.test;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import java.util.Set;
import static android.content.Intent.URI_INTENT_SCHEME;
@Jinmo
Jinmo / jni_all.h
Created May 26, 2017 07:36
Useful when reversing JNI on IDA Pro
/*
* Copyright (c) 1996, 1998, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
@jaisonfdo
jaisonfdo / MixPanelHelper.java
Created November 9, 2016 12:22
Track events with Mixpanel in Android.For more information, check out my detailed guide here : http://droidmentor.com/track-events-mixpanel-android/
import android.content.Context;
import android.util.Log;
import com.mixpanel.android.mpmetrics.MixpanelAPI;
import org.json.JSONException;
import org.json.JSONObject;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
@laobubu
laobubu / ABOUT.md
Last active July 7, 2025 23:42
A very simple HTTP server in C, for Unix, using fork()

Pico HTTP Server in C

This is a very simple HTTP server for Unix, using fork(). It's very easy to use

How to use

  1. include header httpd.h
  2. write your route method, handling requests.
  3. call serve_forever("12913") to start serving on port 12913
@wangmuy
wangmuy / BackTraceUtils.cpp
Created September 13, 2016 10:29
android native stack backtrace
#ifndef BACKTRACE_UTILS_h
#define BACKTRACE_UTILS_h
// ref: http://stackoverflow.com/questions/8115192/android-ndk-getting-the-backtrace
#include <cstdio>
#include <ostream>
#include <sstream>
size_t captureBacktrace(void** buffer, size_t max);
@derofim
derofim / codestyle.md
Last active December 27, 2024 15:03
C++ code style sample
@gabrielepmattia
gabrielepmattia / debug-stack-android.cpp
Created July 24, 2016 09:07
Debug android c++ by printing che callstack in android
#include <utils/CallStack.h>
namespace test {
void myfun(){
android::CallStack stack;
stack.update();
stack.log("<Stack prefix here>");
}
}
@tomykaira
tomykaira / Base64.h
Last active April 23, 2025 22:58
C++ single header base64 decode/encoder for C++ 11 and above.
#ifndef _MACARON_BASE64_H_
#define _MACARON_BASE64_H_
/**
* The MIT License (MIT)
* Copyright (c) 2016-2024 tomykaira
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including