Skip to content

Instantly share code, notes, and snippets.

View nicolas17's full-sized avatar

Nicolás Alvarez nicolas17

  • Buenos Aires, Argentina
View GitHub Profile
@nicolas17
nicolas17 / gist:2663579
Created May 12, 2012 01:28 — forked from rubic/gist:1644599
setuid via subprocess.Popen
#!/usr/bin/env python
import os, subprocess
def change_identity(uid, gid):
def func():
os.setgid(uid)
os.setuid(gid)
return func
cmd = ['uname', '-a']
create repository foundation-git
end repository
match /foundation/trunk/
repository foundation-git
branch master
end match
match /foundation/branches/([^/]+)/
repository foundation-git
@nicolas17
nicolas17 / CMakeLists.txt
Last active December 27, 2015 22:59 — forked from Madsy/gist:7384008
SET( ${PROJECT_NAME}_SOURCES
main.cpp
)
#main.x depends on main.cpp (is generated based on main.cpp)
#main.o depends on main.cpp and main.x (main.x is included in main.cpp)
#So if main.cpp changes, first run the tool to create main.x,
#then run cc to create main.o from main.cpp and main.x
ADD_CUSTOM_COMMAND(
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
#include "preproc.h"
#ifndef GL_KHR_debug
int code() {
return 42;
}
#endif
@nicolas17
nicolas17 / CMakeLists.txt
Last active December 31, 2015 21:39
Add Windows version information to KF5 DLLs
function(WIN32_GEN_VERSION_INFO srclist)
if(NOT WIN32)
return()
endif()
set(options )
set(oneValueArgs VERSION VERSIONSTR FILE_DESC PRODUCT_NAME TARGET COMPANY_NAME)
set(multiValueArgs )
cmake_parse_arguments(WVI "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
# $Id$
#
# This file is part of FreeRCT.
# FreeRCT is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
# FreeRCT is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with FreeRCT. If not, see <http://www.gnu.org/licenses/>.
#
# Sanity check
IF(NOT FREERCT_DONE_TOP_LEVEL_CMAKE)
class Quux;
class Foo {
public:
void (Quux::*ptr)();
};
int main() {
Foo x;
printf("The pointer to member function is %d bytes\n", sizeof(x.ptr));
@nicolas17
nicolas17 / eval.h
Created October 11, 2015 01:27
C preprocessor evilness
#if EVAL_INPUT % 10 == 0
#define EVAL_D1 0
#elif EVAL_INPUT % 10 == 1
#define EVAL_D1 1
#elif EVAL_INPUT % 10 == 2
#define EVAL_D1 2
#elif EVAL_INPUT % 10 == 3
#define EVAL_D1 3
#elif EVAL_INPUT % 10 == 4
#define EVAL_D1 4
@nicolas17
nicolas17 / gist:85f094fd0753cda1e116
Created November 23, 2015 01:31
ld crash compiling a simple iOS tweak
{"bug_type":"109","os_version":"iPhone OS 8.4 (12H143)","build_version":"","blame":[],"symbolicated":true,"app_name":"ld","name":"ld","is_first_party":true,"app_version":"","share_with_app_devs":true,"slice_uuid":"10e851cd-afcd-30ed-a377-c6d95d76aea8"}
Incident Identifier: FE48D1A6-C34A-4B90-BEBD-5571960FA5E8
CrashReporter Key: 939c15172497609b871a2dadc5a86cf4c5a2a190
Hardware Model: iPod5,1
Process: ld [10606]
Path: /usr/bin/ld
Identifier: ld
Version: ???
Code Type: ARM (Native)
Parent Process: clang [10605]
bashdb<20> help info
List of info subcommands:
info args -- Argument variables (e.g. $1, $2, ...) of the current stack frame.
info breakpoints -- Status of user-settable breakpoints
info display -- Show all display expressions
info files -- Source files in the program
info functions -- All function names
info line -- list current line number and and file name
info program -- Execution status of the program.