Skip to content

Instantly share code, notes, and snippets.

@rjzak
rjzak / PyUtils.cpp
Last active May 15, 2024 21:06
Convert between Python list/tuples and C++ vectors
#include <Python.h> // Must be first
#include <vector>
#include <stdexcept>
#include "PyUtils.h"
using namespace std;
// =====
// LISTS
// =====
@anildigital
anildigital / gist:862675ec1b7bccabc311
Created July 26, 2014 18:27
Remove dangling docker images
docker rmi $(docker images -q -f dangling=true)
@nad2000
nad2000 / test.c
Created December 17, 2014 04:41
Basic examples to show how to embed and extend Python in C including: creation of module in C with functions handling and building Python objects; importing and calling python functions from C.
/* Example of embedding Python in another program */
// to compile run:
// gcc -o test $(python-config --cflags) test.c $(python-config --ldflags) && ./test
#include<stdio.h>
#include "Python.h"
void initxyzzy(void); /* Forward */
main(int argc, char **argv)
@darkguy2008
darkguy2008 / UDPSocket.cs
Last active August 27, 2025 22:24
Simple C# UDP server/client in 56 lines
using System;
using System.Net;
using System.Net.Sockets;
using System.Text;
namespace UDP
{
public class UDPSocket
{
private Socket _socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
#Original Author https://raw.githubusercontent.com/kgoedecke/python-ecs-example/master/python_ecs_example/deployment.py
import boto3
import pprint
import os
# Credentials & Region
access_key = os.environ["AWS_ACCESS_KEY_ID"]
secret_key = os.environ["AWS_SECRET_ACCESS_KEY"]
region = "us-east-1"
@MareArts
MareArts / line_circle_rectangle_ellipse_polyline_fillConvexPoly_putText_drawContours.cpp
Last active March 26, 2024 14:34
line, circle, rectangle, ellipse, polyline, fillConvexPoly, putText, drawContours
http://cvlecture.marearts.com/2016/12/opencv-lecture-3-3_23.html
#include "opencv2/opencv.hpp"
using namespace cv;
using namespace std;
int main(int, char)
{
Mat img(500, 500, CV_8UC3);
@cooliscool
cooliscool / create_dataset.py
Last active January 21, 2023 10:18
For selecting only a few number of classes from PASCAL VOC for training in Tensorflow. ( Please refer the code thoroughly :) )
PASCAL_CLASSES = [
'none',
'aeroplane',
'bicycle',
'bird',
'boat',
'bottle',
'bus',
'car',
'cat',
@mryssng
mryssng / ConvertMatToVector.cpp
Last active September 16, 2022 04:27
Convert cv::Mat to std::vector in OpenCV
// https://stackoverflow.com/questions/26681713/convert-mat-to-array-vector-in-opencv
std::vector<uchar> array;
if (mat.isContinuous()) {
array.assign((uchar*)mat.datastart, (uchar*)mat.dataend);
} else {
for (int i = 0; i < mat.rows; ++i) {
array.insert(array.end(), mat.ptr<uchar>(i), mat.ptr<uchar>(i)+mat.cols);
}
}