Skip to content

Instantly share code, notes, and snippets.

View ashwani-rathee's full-sized avatar
☀️
day

Ashwani Rathee ashwani-rathee

☀️
day
View GitHub Profile
@ashwani-rathee
ashwani-rathee / 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
@ashwani-rathee
ashwani-rathee / 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"
@ashwani-rathee
ashwani-rathee / 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
@ashwani-rathee
ashwani-rathee / NewExiffile.jl
Created July 22, 2022 07:32
Write EXIF data to any file
using Pkg
Pkg.activate(".")
include("./lib/LibExif.jl")
using .LibExif
using Images
using JpegTurbo
function init_tag(exif, ifd, tag)
exif1 = unsafe_load(exif)
entry = LibExif.exif_content_get_entry(exif1.ifd[1], tag)
module LibExif
using libexif_jll
export libexif_jll
@enum ExifByteOrder::UInt32 begin
EXIF_BYTE_ORDER_MOTOROLA = 0
EXIF_BYTE_ORDER_INTEL = 1
end
###
# Write example
###
data = Vector{Cuchar}([
0xff, 0xd8, 0xff, 0xe0, 0x00, 0x10, 0x4a, 0x46, 0x49, 0x46, 0x00, 0x01,
0x01, 0x01, 0x00, 0x48, 0x00, 0x48, 0x00, 0x00, 0xff, 0xdb, 0x00, 0x43,
0x00, 0x14, 0x0e, 0x0f, 0x12, 0x0f, 0x0d, 0x14, 0x12, 0x10, 0x12, 0x17,
0x15, 0x14, 0x18, 0x1e, 0x32, 0x21, 0x1e, 0x1c, 0x1c, 0x1e, 0x3d, 0x2c,
0x2e, 0x24, 0x32, 0x49, 0x40, 0x4c, 0x4b, 0x47, 0x40, 0x46, 0x45, 0x50,
0x5a, 0x73, 0x62, 0x50, 0x55, 0x6d, 0x56, 0x45, 0x46, 0x64, 0x88, 0x65,
@ashwani-rathee
ashwani-rathee / LibExif.jl
Created March 8, 2022 05:24
EXIF project
module LibExif
using libexif_jll
mutable struct _ExifContentPrivate end
const ExifContentPrivate = _ExifContentPrivate
mutable struct _ExifContent
entries::Ptr{Ptr{Cvoid}} # entries::Ptr{Ptr{ExifEntry}}
@ashwani-rathee
ashwani-rathee / handgesturerecogniser.jl
Last active January 7, 2023 01:41
hand landmarks and gesture recognition in julia
### A Pluto.jl notebook ###
# v0.17.3
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
using Gtk
win = GtkWindow("Skyring", 300, 350)
set_gtk_property!(win,:resizable,false)
grid = GtkGrid()
set_gtk_property!(grid,:margin,20)
text = ""
@ashwani-rathee
ashwani-rathee / Calculator.jl
Created June 28, 2021 14:27
INIT2022- Day 1
using Gtk
win = GtkWindow("Doritos Calculator", 300, 350)
set_gtk_property!(win,:resizable,false)
grid = GtkGrid()
set_gtk_property!(grid,:margin,20)
text = ""
b1 = GtkButton("1")