Skip to content

Instantly share code, notes, and snippets.

View ashwanirathee's full-sized avatar

Ashwani Rathee ashwanirathee

View GitHub Profile
@ashwanirathee
ashwanirathee / interactivity
Created August 2, 2023 17:05
Pluto Interactivity
### A Pluto.jl notebook ###
# v0.19.27
using Markdown
using InteractiveUtils
# This Pluto notebook uses @bind for interactivity. When running this notebook outside of Pluto, the following 'mock version' of @bind gives bound variables a default value (instead of an error).
macro bind(def, element)
quote
local iv = try Base.loaded_modules[Base.PkgId(Base.UUID("6e696c72-6542-2067-7265-42206c756150"), "AbstractPlutoDingetjes")].Bonds.initial_value catch; b -> missing; end
@ashwanirathee
ashwanirathee / Project.toml
Last active August 10, 2023 06:10
calibration work
[deps]
Cairo = "159f3aea-2a34-519c-b102-8c37f9878175"
CoordinateTransformations = "150eb455-5306-5404-9cee-2592286d6298"
FileIO = "5789e2e9-d7fb-5bc7-8068-2c6fae9b9549"
ImageDraw = "4381153b-2b60-58ae-a1ba-fd683676385f"
Images = "916415d5-f1e6-5110-898d-aaa5f9f070e0"
LazySets = "b4f0291d-fe17-52bc-9479-3d1a343d9043"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Luxor = "ae8d54c2-7ccd-5906-9d76-62fc9837b5bc"
Pluto = "c3e4b0f8-55cb-11ea-2926-15256bba5781"
@ashwanirathee
ashwanirathee / VideoAnalysis.jl
Created July 17, 2023 13:53
Pluto Notebooks
### A Pluto.jl notebook ###
# v0.19.27
using Markdown
using InteractiveUtils
# This Pluto notebook uses @bind for interactivity. When running this notebook outside of Pluto, the following 'mock version' of @bind gives bound variables a default value (instead of an error).
macro bind(def, element)
quote
local iv = try Base.loaded_modules[Base.PkgId(Base.UUID("6e696c72-6542-2067-7265-42206c756150"), "AbstractPlutoDingetjes")].Bonds.initial_value catch; b -> missing; end
struct OctreeQuantization <: AbstractColorQuantizer
numcolors::Int
function OctreeQuantization(
numcolors::Int=256;
kwargs...
)
@info "Struct Create"
return new(numcolors)
end
using GLMakie
scene = Scene()
cam3d!(scene)
c = cameracontrols(scene)
c.eyeposition[] = (0,5,0)
c.lookat[] = Vec3f(0,0,0)
c.upvector[] = (1, 1, 1)
update_cam!(scene)
@ashwanirathee
ashwanirathee / writetags.jl
Created March 3, 2023 15:37
LibExif Issue
using Test,TestImages
using JpegTurbo
include("../lib/LibExif.jl")
include("../src/utils.jl")
include("../src/read.jl")
FILE_BYTE_ORDER = LibExif.EXIF_BYTE_ORDER_INTEL
function init_tag(exif, ifd, tag)
exif1 = unsafe_load(exif)
@ashwanirathee
ashwanirathee / 1.8.5
Last active February 23, 2023 21:07
ExifViewer.jl
### on 1.8.5
# without precompilation
# read uint8 data
# julia> @benchmark read_tags(file; read_all = true)
# BenchmarkTools.Trial: 10000 samples with 1 evaluation.
# Range (min … max): 57.300 μs … 2.119 ms ┊ GC (min … max): 0.00% … 96.37%
# Time (median): 59.400 μs ┊ GC (median): 0.00%
@ashwanirathee
ashwanirathee / serial-access.jl
Created January 14, 2023 06:31
Arduino UNO with Julia project
using LibSerialPort
using Distributed
using ArgParse
portname = "/dev/ttyUSB0"
baudrate = 9600
struct CustomType
val::Int
end
@ashwanirathee
ashwanirathee / convertwebmtogif.txt
Created December 13, 2022 18:03
VideoIO.jl blog post
sudo apt get install ffmpef gifsicle
sInput='1.webm';
sOutput="$(basename "${sInput%.*}")";
ffmpeg -i "${sInput}" -pix_fmt rgb8 "${sOutput}.gif" && gifsicle --optimize=3 --output "${sOutput}-optimized.gif" --resize-height 600 "${sOutput}.gif"
@ashwanirathee
ashwanirathee / outputinvscode.txt
Last active December 8, 2022 13:14
Float Matrix to RGB
Executing task: julia --color=yes --threads=auto --project=/home/ashwani/.julia/environments/v1.7 /home/ashwani/learnhpc/test.jl
result = RGB{Float64}[RGB{Float64}(0.5,0.5,0.5) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0); RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0); RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float6