Skip to content

Instantly share code, notes, and snippets.

View gipsh's full-sized avatar
💭
Loading......

gipsh gipsh

💭
Loading......
View GitHub Profile
@udondan
udondan / Example: golang gorm postgres uuid relation.md
Last active April 25, 2024 17:50
Example: golang gorm postgres uuid relation

Example: golang gorm postgres uuid relation

I was trying forever to get autoloading relationships working with postgres 9.4 and gorm and primary keys of type uuid.

Many tutorials and examples, even those on the official docs were just not workiong or missing important details.

The program in this gist creates the table structure and inserts a nested record. A parent and a child object is created by simply creating the child, which holds the relation to a parent. The child element then is queried by ID. The returned object holds the nested parent object.

Used package versions:

@brimston3
brimston3 / MQTTTransport_mbedTLS.cpp
Created September 12, 2017 15:08
paho.mqtt.embedded-c (C++) with mbedTLS example
/*******************************************************************************
* Copyright 2017 Andrew Domaszek
*
* All rights reserved.
* This program made available under BSD-new.
*******************************************************************************/
/**
* This example is designed for Linux, using such calls as setsockopt and gettimeofday.
* On embedded, it's likely that all of the mbedtls_net_* functions would need to be
@subfuzion
subfuzion / Makefile.md
Last active June 11, 2024 22:07
Makefile for Go projects

Go has excellent build tools that mitigate the need for using make. For example, go install won't update the target unless it's older than the source files.

However, a Makefile can be convenient for wrapping Go commands with specific build targets that simplify usage on the command line. Since most of the targets are "phony", it's up to you to weigh the pros and cons of having a dependency on make versus using a shell script. For the simplicity of being able to specify targets that can be chained and can take advantage of make's chained targets,

#!/bin/bash
################################################################################
### OpenCV2 Installation Script ###
################################################################################
# Source code at https://github.com/arthurbeggs/scripts #
################################################################################
# #
# Feel free to copy and modify this file. Giving me credit for it is your #
# choice, but please keep references to other people's work, which I don't #