Skip to content

Instantly share code, notes, and snippets.

Avatar

Nicklas Ring nicklasring

  • Jönköping
View GitHub Profile
View gist:d8370e8ff05fb55aa44da6f7b071ea17
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 ) {
View TestException
<?php
class TestExceptionHandler extends Exception {
public static function external_logging($callable) {
set_exception_handler(array(
__CLASS__, $callable
));
}
// TODO: PHP7 (Throwable $e)
View docker-compose.yml
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
You can’t perform that action at this time.