Skip to content

Instantly share code, notes, and snippets.

@csghone
csghone / open_source_video_tools.md
Last active August 10, 2020 13:54
Open Source Video Tools

NOTE: This was originally maintained in TI E2E wiki here. It was written primarily for Windows users. Some data might be out of date - corrections are welcome.

Downloads

  • For Ubuntu:
    • sudo apt-get install mpv ffmpeg mplayer mkvtoolnix-gui mkvtoolnix x264 x265 lame
    • If you need nightly builds check following PPAs:
  • Doug McMahon
@csghone
csghone / aws_vpc_setup.md
Last active September 8, 2020 11:52
AWS VPC Setup

Summary

  • Overall setup consists of
    • EC2 instance with open outbound internet access and only SSH inbound access via OpenVPN server
    • S3 endpoints to optimize S3 usage
    • IPSEC tunnel to local firewall
    • OpenVPN server with a public IP

Create an account

@csghone
csghone / enable_if_t.cpp
Last active October 19, 2021 12:58
Example for enable_if_t
// Ref: https://en.cppreference.com/w/cpp/types/enable_if
#include <type_traits>
#include <iostream>
struct TypeTrue {
static constexpr bool enable_if_condition = true;
};
struct TypeFalse {
@csghone
csghone / socat_telnet_example.sh
Created June 23, 2020 07:37
Telnet communication via STDIN/STDOUT using socat
#!/bin/bash
HOST=192.xxx.xxx.xxx
PORT=1234
echo 'some_string' | socat - EXEC:"telnet $HOST $PORT",pty,setsid,ctty | tail -n +5
@csghone
csghone / photography.md
Last active March 11, 2025 06:33
photography

Summary

  • High level explanation of basic photography terminology as well as optics and imaging in general
  • References to give a non-mathematical, intuitive understanding of optics and imaging
  • Corrections/Additions are welcome

Focal length of lenses

@csghone
csghone / listen_udp.sh
Created May 20, 2020 06:55
UDP listener using socat
#!/bin/bash
# listen_feed.sh 224.0.31.130 14382 ens6d1 out_file
# Runs: socat udp-datagram:224.0.31.130:14382,bind=:14382,ip-add-membership=224.0.31.130:ens6d1 /dev/null > out_file
UDP_ADDRESS="224.0.31.130"
UDP_PORT="14382"
INTERFACE="ens6d1"
if [ $# -ne 3 ] && [ $# -ne 4 ]; then
@csghone
csghone / .vimrc
Last active August 18, 2022 09:45
Minmal vimrc
" If startup is slow - change clipboard options
" Show line/row/col numbers
set showcmd " This should be before nocompatible or nocp
set nu
set ruler
set laststatus=2
set incsearch
set history=10000
@csghone
csghone / using_cffi_module.py
Last active May 7, 2020 07:03
CFFI Python Example - Part 2/2
from cffi_example.lzo_ext import ffi, lib
# `compressed_data` is `bytes` array
# `compressed_data_len` is int
uncompressed_data = ffi.new("char[]", 10000)
ret_val = lib.decompress(compressed_data, compressed_data_len, uncompressed_data)
@csghone
csghone / generate_cffi_example_module.py
Last active May 7, 2020 07:03
CFFI Python Example - Part 1/2
# Generate module `cffi_example` using `python3 generate_cffi_example_module.py`
import os
from cffi import FFI
ffi = FFI()
person_header = """
unsigned int decompress(const uint8_t* raw_data, size_t compressed_size, uint8_t* decompressed_data);
"""
@csghone
csghone / logging_exceptions_argparsing_retry_in_python.py
Last active June 18, 2020 02:16
Python - Logging, Exceptions, ArgParse, Retry sample code
#!/usr/bin/env python3
"""
eg:
python3 ./logging_exceptions_argparsing_retry_in_python.py -w -x opt1 -y 3 -z 1 2 3 -f ~/.bashrc -d 20190101 --inp_datestring 20191101
"""
from __future__ import print_function
import os
import sys
import argparse