Skip to content

Instantly share code, notes, and snippets.

View ckocyigit's full-sized avatar

Can Kocyigit ckocyigit

View GitHub Profile
@ckocyigit
ckocyigit / stream.py
Created October 10, 2024 07:00
python stream webcam over http
import cv2
from flask import Flask, Response
app = Flask(__name__)
camera = cv2.VideoCapture(0)
def generate_frames():
while True:
success, frame = camera.read()
@ckocyigit
ckocyigit / docker.sh
Created August 19, 2024 14:52
install docker engine
# Add Docker's official GPG key:
sudo apt-get update
sudo apt-get install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
# Add the repository to Apt sources:
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian \
@ckocyigit
ckocyigit / immich-trasher.js
Created June 15, 2024 08:18
Immich frontend duplicates button smasher - (made in minutes, works on my machine, no guarantees :)
(function() {
const buttonLabelPattern = /^Trash \d+$/;
const interval = 1000;
const checkInterval = 500;
let clickIntervalId = null;
let checkTimeoutId = null;
function clickButton() {
const buttons = document.querySelectorAll('button');
@ckocyigit
ckocyigit / trivy_tsv.tpl
Created April 9, 2024 13:39
Trivy TSV Template
"Image" "Title" "Description" "Severity" "Vulnerability ID" "Vendor ID" "Package Class" "Package Type" "Package Name" "Installed Version" "Fixed Version" "Severity Source" "Primary Url" "Reference"
{{- range $ri, $r := . }}
{{- $imageName := $r.Target }}
{{- $pkgClass := $r.Class }}
{{- $pkgType := $r.Type }}
{{- range $vi, $v := .Vulnerabilities }}
{{$imageName}} {{ $v.Title }} {{ $v.Description }} {{$v.Severity}} {{ $v.VulnerabilityID }} {{$v.VendorIDs | join ", "}} {{ $pkgClass }} {{$pkgType}} {{ $v.PkgName }} {{$v.InstalledVersion }} {{ $v.FixedVersion }} {{$v.SeveritySource}} {{$v.PrimaryURL}} "{{$v.References | join "\r"}}"
{{- end}}
{{- end }}
@ckocyigit
ckocyigit / migrate.sh
Created April 1, 2024 17:42
Completely migrate one container registry to another
#!/bin/bash
# Define source and destination registry
source_registry="https://source.registry.com"
destination_registry="https://destination.registry.com"
# Authenticate if needed
auth="--user <username>:<password>" # if authentication is required, otherwise leave it empty
auth_param=""
if [ -n "$auth" ]; then
@ckocyigit
ckocyigit / sum.py
Created February 12, 2023 11:40
AZAD's Python file to sum up total amount for amazon orders
import glob, csv
sum: float = 0
orders: int = 0
for file in glob.glob("*.csv"):
with open(file, 'r') as input:
csvInput = csv.DictReader(input)
for row in csvInput:
if 'SUBTOTAL' in row['total']:
continue
@ckocyigit
ckocyigit / converter.py
Created October 18, 2022 20:17
Convert Bitwarden CSV to Passbolt CSV
import csv
INPUT_FILENAME: str = 'bitwarden_export_20221018212756.csv'
OUTPUT_FILENAME: str = 'passbolt_converted.csv'
def csvParse(file):
with open(file, newline='') as csvfile:
rows = []
csvreader = csv.reader(csvfile, delimiter=',', quotechar='"')
header = next(csvreader)