Skip to content

Instantly share code, notes, and snippets.

@priteshgohil
priteshgohil / webcam_opencv.cpp
Last active March 5, 2025 01:22
C++ code to read images from webcam using CV 4.1.1
#include <opencv2/opencv.hpp>
#include <iostream>
int main(int, char**) {
// open the first webcam plugged in the computer
cv::VideoCapture camera(0); // in linux check $ ls /dev/video0
if (!camera.isOpened()) {
std::cerr << "ERROR: Could not open camera" << std::endl;
return 1;
}
@kangtastic
kangtastic / md4.py
Last active September 29, 2024 01:38
An implementation of the MD4 hash algorithm in pure Python 3.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright © 2019 James Seo <[email protected]> (github.com/kangtastic).
#
# This file is released under the WTFPL, version 2 (wtfpl.net).
#
# md4.py: An implementation of the MD4 hash algorithm in pure Python 3.
#
# Description: Zounds! Yet another rendition of pseudocode from RFC1320!
@akmandev
akmandev / Nginx - Disable Cache.conf
Created February 12, 2017 20:40
Nginx disabling static file cache for local development
location / {
add_header 'Cache-Control' 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0';
expires off;
}
#!/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 #
@vivithemage
vivithemage / boost_list_directory.cpp
Created March 12, 2014 22:18
list all files in directory with boost
#include <iostream>
#include "boost/filesystem.hpp"
using namespace std;
using namespace boost::filesystem;
int main(int argc, char *argv[])
{
// list all files in current directory.
//You could put any file path in here, e.g. "/home/me/mwah" to list that directory
@suma
suma / _etc_init.d_autosshd
Last active August 25, 2020 07:38
Autossh init script(Ubuntu) for reverse ssh tunneling
#! /bin/sh
### BEGIN INIT INFO
# Provides: autosshd
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: autosshd initscript
# Description: This file should be used to construct scripts to be
# placed in /etc/init.d.
@w0rm
w0rm / restful_app.py
Last active May 13, 2021 17:16
RESTful controller with web.py
import web
import json
from restful_controller import RESTfulController
urls = (
r'/resources(?:/(?P<resource_id>[0-9]+))?',
'ResourceController',
)
@maxlapshin
maxlapshin / capture_raw_frames.c
Created September 30, 2011 11:50
v4l2 capture example
/*
* V4L2 video capture example
*
* This program can be used and distributed without restrictions.
*
* This program is provided with the V4L2 API
* see http://linuxtv.org/docs.php for more information
*/
#include <stdio.h>
@amercader
amercader / gist:927079
Created April 19, 2011 09:55
British National Grid to WGS84 with pyproj
import pyproj
# Define two projections, one for the British National Grid and one for WGS84 (Lat/Lon)
# You can use the full PROJ4 definition or the EPSG identifier (PROJ4 uses a file that matches the two)
#bng = Proj("+proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 +x_0=400000 +y_0=-100000 +ellps=airy +datum=OSGB36 +units=m +no_defs towgs84='446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894'")
#wgs84 = Proj('+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs')
bng = pyproj.Proj(init='epsg:27700')
wgs84 = pyproj.Proj(init='epsg:4326')