Skip to content

Instantly share code, notes, and snippets.

@Muchene
Muchene / dlopen_sample.c
Created December 21, 2020 17:26 — forked from tailriver/ dlopen_sample.c
A sample of using dlopen library.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <dlfcn.h>
int main(int argc, char** argv)
{
void *handle;
void (*func_print_name)(const char*);
from multiprocessing import Process
import socket
import os
import time
DEFAULT_PORT = 5454
class Client(Process):
/*
* Author: David Robert Nadeau
* Site: http://NadeauSoftware.com/
* License: Creative Commons Attribution 3.0 Unported License
* http://creativecommons.org/licenses/by/3.0/deed.en_US
*/
#if defined(_WIN32)
#include <Windows.h>
#define C_UNIQUE_PTR __attribute__((cleanup(cleanup_free)))
static void cleanup_free(void *p)
{
free(*(void **)p); // in some platform we might have to check for nulls
}
docker create -v /var/lib/postgresql/data --name PostgresData alpine
docker run --name some_name -p 5432:5432 -e POSTGRES_DB=scribe -e POSTGRES_PASSWORD=bogus_password -d --volumes-from PostgresData postgres
@Muchene
Muchene / reflection.go
Created February 14, 2018 21:13 — forked from drewolson/reflection.go
Golang Reflection Example
package main
import (
"fmt"
"reflect"
)
type Foo struct {
FirstName string `tag_name:"tag 1"`
LastName string `tag_name:"tag 2"`