Skip to content

Instantly share code, notes, and snippets.

View zainmehdi's full-sized avatar
😀

Zain zainmehdi

😀
View GitHub Profile
@justinschuldt
justinschuldt / raspberry-pi-zero_as_webcam.md
Last active October 7, 2024 10:40
Directions for setting up a RaspberryPi to act as a generic USB webcam

hardware/software

Webcam parts:

  • Raspberry Pi Zero W Rev 1.1
  • Raspberry Pi Camera v2 (8-megapixel)
  • Raspberry Pi High Quality Camera (12.3-megapixel)
  • Raspbian Buster Lite 2020-02-13

Webcam works with:

  • Windows 10
  • Windows 10 "Camera" app
@stecman
stecman / STM8S_programming_examples.md
Last active August 20, 2024 18:26
STM8S code examples

This is a collection of code snippets for various features on the STM8S family microcontrollers (specifically the STM8S003F3). These are written against the STM8S/A SPL headers and compiled using SDCC.

Some of this controller's functions aren't particularly intuitive to program, so I'm dumping samples for future reference here. These are based on the STM8S documentation:

Run at 16MHz

@LimHyungTae
LimHyungTae / angle_type_conversion.cpp
Last active December 4, 2023 14:45
ROS quaternion to rotation matrix OR rotation matrix to roll-pitch-yaw OR roll-pitch-yaw to quaternion
#include <iostream>
#include <tf/tf.h>
int main(){
/**< Declaration of quaternion */
tf::Quaternion q;
q.setW(1);
q.setX(0);
q.setY(0);
@mirzak
mirzak / mender-client.sh
Last active April 20, 2020 05:44
A fake Mender client implemented in bash
#!/bin/bash
MENDER_SERVER_URL="https://hosted.mender.io"
MENDER_TENANT_TOKEN=""
MENDER_DEVICE_TYPE=""
# This variable is mutable
MENDER_ARTIFACT_NAME="release-v1"
function show_help() {
@Tiryoh
Tiryoh / ros_melodic_install_raspizero.bash
Created October 16, 2019 03:33
ROS Melodic installation on Raspberry Pi Zero/Raspberry Pi Zero W
#!/usr/bin/env bash
set -eu
# (C) 2019 Daisuke Sato
# https://tiryoh.mit-license.org/2019
# Special thanks to @nomumu
sudo apt update
sudo apt install -y build-essential gdebi
mkdir -p ~/tmp && pushd ~/tmp
@ialhashim
ialhashim / fill_depth_colorization.py
Last active September 5, 2024 05:27
Python implementation of depth filling from NYU Depth v2 toolbox
# Original Matlab code https://cs.nyu.edu/~silberman/datasets/nyu_depth_v2.html
#
#
# Python port of depth filling code from NYU toolbox
# Speed needs to be improved
#
# Uses 'pypardiso' solver
#
import scipy
import skimage
@syneart
syneart / OpenCV3.2withContrib.sh
Last active April 27, 2024 01:30
OpenCV 3.2 with Contrib install script [CUDA supported]
######################################
# INSTALL OPENCV ON UBUNTU OR DEBIAN #
######################################
# Use below command to install OpenCV 3.2 with Contrib at Ubuntu or Debian on your own operating system.
# wget -O - https://gist.githubusercontent.com/syneart/3e6bb68de8b6390d2eb18bff67767dcb/raw/OpenCV3.2withContrib.sh | bash
# | THIS SCRIPT IS TESTED CORRECTLY ON |
# |-----------------------------------------------------------|
# | OS | OpenCV | CUDA | Test | Last test |
@fm4dd
fm4dd / gcc compiler optimization for arm systems.md
Last active October 12, 2024 17:08
GCC compiler optimization for ARM-based systems

GCC compiler optimization for ARM-based systems

2017-03-03 fm4dd

The gcc compiler can optimize code by taking advantage of CPU specific features. Especially for ARM CPU's, this can have impact on application performance. ARM CPU's, even under the same architecture, could be implemented with different versions of floating point units (FPU). Utilizing full FPU potential improves performance of heavier operating systems such as full Linux distributions.

-mcpu, -march: Defining the CPU type and architecture

These flags can both be used to set the CPU type. Setting one or the other is sufficient.

@darkguy2008
darkguy2008 / UDPSocket.cs
Last active August 31, 2024 13:52
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);
@mik30s
mik30s / webcam_capture.cpp
Last active July 27, 2024 14:28
Simple C++ program to capture a webcam frame in Linux
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <linux/ioctl.h>
#include <linux/types.h>
#include <linux/v4l2-common.h>
#include <linux/v4l2-controls.h>
#include <linux/videodev2.h>
#include <fcntl.h>
#include <unistd.h>