Skip to content

Instantly share code, notes, and snippets.

View Chhunneng's full-sized avatar
:electron:
Coding the future

Chrea Chanchhunneng Chhunneng

:electron:
Coding the future
View GitHub Profile
@Chhunneng
Chhunneng / convert_image.py
Created October 23, 2023 02:22
This code is use to convert any image extension with ImageMagick
from PIL import Image
temp_original_picture_path = "./image.HEIC"
temp_converted_picture_path = "./image.png"
# make sure you install ImageMagick in your machine
# https://imagemagick.org/script/download.php
try:
import pillow_avif
from PIL import Image
def watermark(img_path, watermark_path, output_path):
# watermark_path is the image of watermark. Not text
with Image.open(img_path) as im:
width, height = int(im.size[0]), int(im.size[1])
x_interval = int(width / 10)
y_interval = int(height / 10)
with Image.open(watermark_path) as watermark:
# Load watermark and resize to fit
@Chhunneng
Chhunneng / git.md
Created May 9, 2022 04:24 — forked from jneptune/git.md
GIT Commands and Actions

GIT Commands and Actions

Create Repo

New Local Repo git init [project-name]
Copy Remote Repo git clone [url] [?name]

Making Changes

library(quantmod)
library(ggplot2)
library(magrittr) # for %>% function
library(broom) # tidy function
start = as.Date("2021-01-01")
end = as.Date("2021-12-01")
getSymbols("GOOGL", src = "yahoo", from = start, to = end)
write.zoo(GOOGL, "GOOGL.csv", sep = ",")
stocks = as.xts(data.frame(A = GOOGL[, "GOOGL.Adjusted"]))
stocks_series = tidy(stocks) %>%