Skip to content

Instantly share code, notes, and snippets.

Avatar
🎵

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
View build-curl-android.sh
#!/bin/bash
# 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
davidzchen / sample-google.c
Last active Apr 20, 2021
Sample C code using the Google C++ style guide
View sample-google.c
// Sample file using the Google C++ coding standard.
//
// http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml
//
// 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
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>
//m=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
// Open can be interupted when blocked, waiting for a slow device such as a
@ceme
ceme / bash_curl_loop
Last active Apr 7, 2021
bash curl loop
View bash_curl_loop
while true; do sleep 1; curl http://www.google.com; echo -e '\n\n\n\n'$(date);done
@aspyct
aspyct / signal.c
Last active Apr 29, 2021
Unix signal handling example in C, SIGINT, SIGALRM, SIGHUP...
View signal.c
/**
* More info?
* a.dotreppe@aspyct.org
* http://aspyct.org
*
* Hope it helps :)
*/
#include <stdio.h>
#include <stdlib.h>
@vndmtrx
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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@ianmackinnon
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>