Skip to content

Instantly share code, notes, and snippets.


silvioprog silvioprog

View GitHub Profile
View escapetest.c
// Compile with -std=c11
#include <stdlib.h>
#include <stdarg.h>
#include <stdio.h>
#include <inttypes.h>
#include <string.h>
#include <limits.h>
#define MAX_STR_LEN 4095
# Download and build libcurl, openssl and zlib for Android using Crystax NDK r7
# Must be run on 32 bit Linux as the Crystax r7 NDK doesn't support 64 bit hosts
# Tested on Ubuntu 14.04
# Make the working directory
mkdir curl-android-build
cd curl-android-build
ROOT_DIR=`pwd -P`
davidzchen / sample-google.c
Last active Jul 15, 2022
Sample C code using the Google C++ style guide
View sample-google.c
// Sample file using the Google C++ coding standard.
// General rules:
// - Indents are two spaces. No tabs should be used anywhere.
// - Each line must be at most 80 characters long.
// - Comments can be // or /* but // is most commonly used.
// - File names should be lower_case.c or lower-case.c
m-renaud / eintr-handling.c
Last active Apr 5, 2018
EINTR handling.
View eintr-handling.c
// Examples of EINTR handling for reentrant functions.
#include <errno.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
// Open can be interupted when blocked, waiting for a slow device such as a
ceme / bash_curl_loop
Last active Jul 15, 2022
bash curl loop
View bash_curl_loop
while true; do sleep 1; curl; echo -e '\n\n\n\n'$(date);done
aspyct / signal.c
Last active Jun 22, 2022
Unix signal handling example in C, SIGINT, SIGALRM, SIGHUP...
View signal.c
* More info?
* Hope it helps :)
#include <stdio.h>
#include <stdlib.h>
vndmtrx / epoll_sock.c
Created Aug 17, 2012
Socket não bloqueante com notificação de eventos usando epoll()
View epoll_sock.c
/* Copyright 2012 Eduardo Rolim
* 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
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
ianmackinnon / match.c
Created Aug 8, 2012
C Regex multiple matches and groups example
View match.c
# gcc -Wall -o match match.c && ./match
#include <stdio.h>
#include <string.h>
#include <regex.h>