Skip to content

Instantly share code, notes, and snippets.

View yatharthb97's full-sized avatar

Yatharth Bhasin yatharthb97

View GitHub Profile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@TheCherno
TheCherno / Instrumentor.h
Last active June 25, 2024 18:39
Basic Instrumentation Profiler
//
// Basic instrumentation profiler by Cherno
// Usage: include this header file somewhere in your code (eg. precompiled header), and then use like:
//
// Instrumentor::Get().BeginSession("Session Name"); // Begin session
// {
// InstrumentationTimer timer("Profiled Scope Name"); // Place code like this in scopes you'd like to include in profiling
// // Code
// }
@nadavrot
nadavrot / Matrix.md
Last active June 23, 2024 10:25
Efficient matrix multiplication

High-Performance Matrix Multiplication

This is a short post that explains how to write a high-performance matrix multiplication program on modern processors. In this tutorial I will use a single core of the Skylake-client CPU with AVX2, but the principles in this post also apply to other processors with different instruction sets (such as AVX512).

Intro

Matrix multiplication is a mathematical operation that defines the product of

@GrayJack
GrayJack / config.txt
Last active May 28, 2024 11:46
Very complete and documented config.txt file for raspberry pi
# See /boot/overlays/README for all available options
##############################################################################
## Raspberry Pi Configuration Settings
##
## Revision 18, 2018/03/05
##
## Details taken from the eLinux wiki
## For up-to-date information please refer to wiki page.
##
## Wiki Location : http://elinux.org/RPiconfig
@rwb27
rwb27 / set_picamera_gain.py
Last active April 27, 2023 15:09
Manually setting gain of raspberry pi camera from within python
from __future__ import print_function
import picamera
from picamera import mmal, mmalobj, exc
from picamera.mmalobj import to_rational
import time
MMAL_PARAMETER_ANALOG_GAIN = mmal.MMAL_PARAMETER_GROUP_CAMERA + 0x59
MMAL_PARAMETER_DIGITAL_GAIN = mmal.MMAL_PARAMETER_GROUP_CAMERA + 0x5A
@vidavidorra
vidavidorra / auto-deploy_documentation.md
Last active June 5, 2024 19:20
Auto-deploying Doxygen documentation to gh-pages with Travis CI

Auto-deploying Doxygen documentation to gh-pages with Travis CI

This explains how to setup for GitHub projects which automatically generates Doxygen code documentation and publishes the documentation to the gh-pages branch using Travis CI. This way only the source files need to be pushed to GitHub and the gh-pages branch is automatically updated with the generated Doxygen documentation.

Sign up for Travis CI and add your project

Get an account at Travis CI. Turn on Travis for your repository in question, using the Travis control panel.

Create a clean gh-pages branch

To create a clean gh-pages branch, with no commit history, from the master branch enter the code below in the Git Shell. This will create a gh-pages branch with one file, the README.md in it. It doesn't really matter what file is uploaded in it since it will be overwritten when the automatically generated documentation is published to th

@Overdrivr
Overdrivr / Plot.py
Last active March 8, 2023 09:37
Plots data to a PyQtGraph graph that is hosted another process, effectively liberating main thread immediately.
# -*- coding: utf-8 -*-
"""
This example is identical to https://gist.github.com/Overdrivr/efea3d363556c0dcf4b6
Except that here the plot is contained in a class.
The superplot.start method starts the graph and returns a standard multiprocessing.queue
the io function puts data in this queue, while the graph empties it regularly
The outcome is :
- a super fast application thanks to PyQtGraph
- a main process that is never blocked by the graph
Enjoy !
@kylemcdonald
kylemcdonald / showarray.py
Created January 3, 2016 08:56
Minimal code for rendering a numpy array as an image in a Jupyter notebook in memory. Borrowed from the Deep Dream notebook.
import PIL.Image
from cStringIO import StringIO
import IPython.display
import numpy as np
def showarray(a, fmt='png'):
a = np.uint8(a)
f = StringIO()
PIL.Image.fromarray(a).save(f, fmt)
IPython.display.display(IPython.display.Image(data=f.getvalue()))
@brandoncurtis
brandoncurtis / AnalogReadSerial.ino
Last active January 29, 2024 20:47
Realtime Data Acquisition and Plotting with Arduino and Python
/*
AnalogReadSerial
Reads an analog input on pin 0, prints the result to the serial monitor.
Attach the center pin of a potentiometer to pin A0, and the outside pins to +5V and ground.
This example code is in the public domain.
Upload this to the Arduino using the Arduino IDE!
*/
@marc-hanheide
marc-hanheide / vlc-stream.sh
Last active November 15, 2023 06:53
VLC screen streaming mjpeg
DISPLAY=:0 cvlc -vvv --no-audio screen:// --screen-fps 1 --sout "#transcode{vcodec=MJPG,vb=800}:standard{access=http,mux=mpjpeg,dst=:18223/}" --sout-http-mime="multipart/x-mixed-replace;boundary=--7b3cc56e5f51db803f790dad720ed50a"