Skip to content

Instantly share code, notes, and snippets.

@cristipufu
cristipufu / producer_consumer.py
Created March 1, 2017 00:35
Producer-consumer problem in python
import sys
import random
import time
from threading import *
class Producer(Thread):
def __init__(self, items, can_produce, can_consume):
Thread.__init__(self)
self.items = items
self.can_produce = can_produce
@ClintLiddick
ClintLiddick / External_GTest.cmake
Last active April 26, 2024 14:18
CMake ExternalProject_Add for Google Mock (gmock) and Google Test (gtest) Libraries
find_package(Threads REQUIRED)
ExternalProject_Add(
googletest
GIT_REPOSITORY https://github.com/google/googletest.git
UPDATE_COMMAND ""
INSTALL_COMMAND ""
LOG_DOWNLOAD ON
LOG_CONFIGURE ON
LOG_BUILD ON)
@bertrandmartel
bertrandmartel / build_curl.md
Last active May 27, 2025 16:11
Build Curl for Android NDK

Build libcurl for android NDK

Libcurl requires openssl and zlib to be fully operationnal

  • Step 1 : cross compile zlib
  • Step 2 : cross compile openssl
  • Step 3 : cross compile curl with zlib/openssl external link

Prerequisites :

@dghost
dghost / gist:f80e58e93c1f5a67254e
Last active January 29, 2019 03:45
FindSteamworks.cmake - quick and dirty CMake support for the Steamworks SDK
# Locate Steamworks library
# This module defines
# STEAMWORKS_LIBRARY, the name of the library to link against
# STEAMWORKS_INCLUDE_DIR, the directory containing steam/steam_api.h
# STEAMWORKS_FOUND, if false, do not try to link to Steamworks
#
# If a path is set in the SteamworksDIR environment variable it will check there
#
# This has been tested on OS X
# This may or may not with Linux - it should, but i think it could be broken easily
@dulacp
dulacp / libpng.sh
Last active December 7, 2019 07:54
Download & Compile Libpng for iOS (all architectures)
# Builds a Libpng framework for the iPhone and the iPhone Simulator.
# Creates a set of universal libraries that can be used on an iPhone and in the
# iPhone simulator. Then creates a pseudo-framework to make using libpng in Xcode
# less painful.
#
# To configure the script, define:
# IPHONE_SDKVERSION: iPhone SDK version (e.g. 8.1)
#
# Then go get the source tar.bz of the libpng you want to build, shove it in the
# same directory as this script, and run "./libpng.sh". Grab a cuppa. And voila.
@tylerneylon
tylerneylon / copy.lua
Last active May 13, 2025 13:44
How to deep copy Lua values.
-- copy.lua
--
-- Lua functions of varying complexity to deep copy tables.
--
-- 1. The Problem.
--
-- Here's an example to see why deep copies are useful. Let's
-- say function f receives a table parameter t, and it wants to