Skip to content

Instantly share code, notes, and snippets.

View nicklasring's full-sized avatar

Nicklas Ring nicklasring

View GitHub Profile
char * get_current_user() {
char user_name[64] = {0};
if( getlogin_r(user_name, sizeof(user_name)-1) != 0 ) {
printf("Error fetching current user");
exit(1);
}
// Allocate memory on heap for user_name and return pointer
char * username_heap_alloc = malloc( strlen(user_name) + 1 ); // Nullterminator + 1
if( username_heap_alloc ) {
<?php
class TestExceptionHandler extends Exception {
public static function external_logging($callable) {
set_exception_handler(array(
__CLASS__, $callable
));
}
// TODO: PHP7 (Throwable $e)
version: "2"
services:
node1:
container_name: node1
image: percona/percona-xtradb-cluster:5.7
environment:
- CLUSTER_NAME=cluster1
- MYSQL_ROOT_PASSWORD=root
networks:
- pxc-network