Skip to content

Instantly share code, notes, and snippets.

@saisasidhar
saisasidhar / eos_as_videofeed.md
Created December 1, 2020 15:32
Canon EOS as video feed in Arch Linux
➜ uname -r
# get installed kernel version
➜ pacman -S linux-headers
# select kernel version
@saisasidhar
saisasidhar / alapasty.vim
Created March 27, 2021 19:50
Paste text from alacritty into vim without additional blanklines
" Paste text from alacritty (windows) into vim without additional blanklines
" Issue: https://github.com/alacritty/alacritty/issues/2324
"
" Place this vim file in a plugin directory of vim. Example: $HOME/.vim/plugin/alapasty.vim
" Type `:Ap<Cr>` to open up a buffer in insert mode. Use `Shift+Insert` to copy text into this buffer.
" Press <Esc> and the text will be formatted and placed in the originating buffer
"
" Note: This plugin takes care of some common edge-cases when working with code. Make sure the first few lines are
" either blank (just line endings is okay) or it has the first line of the content you want to paste.
" This is critical because the script uses "%normal jdd" to dispatch repetitive jump and delete motions over the entire file.
@saisasidhar
saisasidhar / overview.txt
Created November 27, 2019 22:06
PyQt Strategy for CPU Bound Tasks
Managed By
Main Process ProcessPoolExecutor
+-------------------------------------------+ +---------------+
| MainThread QTaskRunner | | |
| +-----------+ +----------+ | executor.submit | +---------+ |
| | | | QThread +------------------->+ | P#1 | |
| | | | | | Future | | | |
| | | | +<-------------------+ | | |
| | | | | | PIPE | | +-----+ | |
| | | | +--+-----------------+--->+ | | |
Some people, when confronted with a problem, think "I know, I'll use regular expressions." Now they have two problems.
-- Jamie Zawinski
http://codemines.blogspot.com/2006/08/now-they-have-two-problems.html
01
23
36
FE
00
00
60
02
C1
EC
# Based on elessar theme
# https://github.com/fjpalacios/elessar-theme
# Which is based on Gitster theme
# https://github.com/shashankmehta/dotfiles/blob/master/thesetup/zsh/.oh-my-zsh/custom/themes/gitster.zsh-theme
local ret_status="%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ )"
function get_pwd(){
git_root=$PWD
@saisasidhar
saisasidhar / asyncio_unary_stream_grpc.py
Created March 5, 2019 10:23
Python asyncio snippet for server streaming RPCs
"""
From: https://grpc.io/docs/guides/concepts.html
Server streaming RPCs where the client sends a request to the server and gets a stream to read a sequence of messages back. The client reads from the returned stream until there are no more messages. gRPC guarantees message ordering within an individual RPC call.
rpc LotsOfReplies(HelloRequest) returns (stream HelloResponse){}
"""
import asyncio
import janus
// gcc -o demo demo.c api.c usb.c -L. -lhidapi-libusb -lrt -lusb-1.0 -ldlpspec -lm -fno-stack-protector
#include <stdio.h>
#include "common.h"
#include "usb.h"
#include "api.h"
int main()
{
USB_Init();
/*
Yep, this is not the reason for improved transfer rate.
Code courtesy of PCO
*/
static void
adapt_camera_memory(UcaPcowinCameraPrivate *priv)
{
gboolean do_adapt = FALSE; // Set to FALSE to prepare for checking valid images
DWORD dwTest;
DWORD dwTest2;
#include<stdio.h>
#include<stdlib.h>
#include<sys/types.h>
#include"include/uv.h"
struct my_data{
int fd;
char *buf;
}priv;