Skip to content

Instantly share code, notes, and snippets.

@jgilfelt
jgilfelt / DrawerSafeViewPager.java
Last active December 19, 2015 09:39
DrawerLayout friendly ViewPager that will ignore rogue touch events from the bezel swipe gesture.
/*
* Copyright (C) 2013 readyState Software Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@tbenthompson
tbenthompson / function_serialize.cpp
Last active December 12, 2022 09:28
Serializing functions in C++
#include <iostream>
#include <sstream>
#include <fstream>
/* Serialize a function by writing out a pointer to its location in memory.
* This will only work between two processes running identical binaries.
*
* One difficulty is ASLR:
* Address space layout randomization (ASLR) puts functions in a different
* place in memory everytime a program is loaded. Within a given binary
@jrelo
jrelo / gcc-security.txt
Last active November 14, 2024 06:54
GCC security related flags reference.
Source material:
http://security.stackexchange.com/questions/24444/what-is-the-most-hardened-set-of-options-for-gcc-compiling-c-c
https://wiki.gentoo.org/wiki/Hardened_Gentoo
https://wiki.debian.org/Hardening
================================================================================================================>
GCC Security related flags and options:
CFLAGS="-fPIE -fstack-protector-all -D_FORTIFY_SOURCE=2"
LDFLAGS="-Wl,-z,now -Wl,-z,relro"
@heartonbit
heartonbit / gist:2575ce02ca730559d2f2c65eb8682231
Created March 20, 2018 02:04
GCC 7 on Ubuntu 14.04 & 16.04
https://gist.github.com/application2000/73fd6f4bf1be6600a2cf9f56315a2d91
sudo apt-get update -y && \
sudo apt-get upgrade -y && \
sudo apt-get dist-upgrade -y && \
sudo apt-get install build-essential software-properties-common -y && \
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y && \
sudo apt-get update -y && \
sudo apt-get install gcc-7 g++-7 -y && \
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 60 --slave /usr/bin/g++ g++ /usr/bin/g++-7 && \