Skip to content

Instantly share code, notes, and snippets.

View mzuvin's full-sized avatar
🎯
Focusing

Mustafa Zuvin mzuvin

🎯
Focusing
View GitHub Profile
@f
f / customChat.js
Last active February 7, 2024 18:57
create custom chatgpt conversation
// thanks to x.com/umutbasalt
function generateUUID() {
function r() {
return Math.floor(Math.random() * 65536).toString(16).padStart(4, '0');
}
return (
r() + r() + "-" +
r() + "-" +
@davepcallan
davepcallan / tableRowAndSize.sql
Created January 23, 2024 17:44
SQL Server query to get row counts and size (MB) for all tables in a DB
;WITH TableSizes AS (
SELECT
s.Name AS SchemaName,
t.NAME AS TableName,
p.rows AS RowCounts,
CAST(SUM(a.total_pages) * 8 / 1024.0 AS DECIMAL(10, 2)) AS TotalSpaceMB
FROM
sys.tables t
INNER JOIN
sys.indexes i ON t.OBJECT_ID = i.object_id

It's impossible to install PyQt5 out of the box with pip in Raspbian Buster

Here is what I did

It's quite long beat with me. (First part is from official guide with extended dependencies https://wiki.qt.io/Building_Qt_5_from_Git) First we enable source repo

sudo nano /etc/apt/sources.list

To enable it we need to uncomment in the following way

@llloo
llloo / MultiCheckboxField.py
Last active April 30, 2022 04:38
Flask MultiCheckboxField
from flask import Flask, render_template, request
from flask_wtf import FlaskForm
from wtforms import (SubmitField, SelectMultipleField, widgets)
class MultiCheckboxField(SelectMultipleField):
widget = widgets.ListWidget(prefix_label=False)
option_widget = widgets.CheckboxInput()
class ExampleForm(FlaskForm):
nums = MultiCheckboxField('label'
@Atinux
Atinux / async-foreach.js
Last active October 10, 2023 03:04
JavaScript: async/await with forEach()
const waitFor = (ms) => new Promise(r => setTimeout(r, ms))
const asyncForEach = async (array, callback) => {
for (let index = 0; index < array.length; index++) {
await callback(array[index], index, array)
}
}
const start = async () => {
await asyncForEach([1, 2, 3], async (num) => {
await waitFor(50)
@dvlden
dvlden / ffmpeg.md
Last active April 17, 2024 19:53
Convert video files to MP4 through FFMPEG

This is my personal list of functions that I wrote for converting mov files to mp4!

Command Flags

Flag Options Description
-codec:a libfaac, libfdk_aac, libvorbis Audio Codec
-quality best, good, realtime Video Quality
-b:a 128k, 192k, 256k, 320k Audio Bitrate
-codec:v mpeg4, libx264, libvpx-vp9 Video Codec
@zougloub
zougloub / dvr.py
Last active May 13, 2023 07:58
Tiny DVR for RTSP/H264 cameras
#!/usr/bin/env python
# -*- coding:utf-8 vi:noet
# RTSP/H264 simple camera DVR
__author__ = "Jérôme Carretero <cJ-tub@zougloub.eu>"
__license__ = "MIT"
import sys, io, os, re, time, datetime
import gi
@teocci
teocci / compile_ffmpeg.md
Last active December 18, 2022 00:15
Compile FFmpeg on Ubuntu 16.04

Compile FFmpeg on Ubuntu

This basic guide supports Ubuntu Xenial Xerus 16.04 and will enable several external encoding and decoding libraries: libfaac (AAC encoder), libfdk-aac (AAC encoder), libmp3lame (MP3 encoder), libopencore-amr (AMR encoder/decoder), librtmp (for additional RTMP protocols), libtheora (Theora encoder), libvorbis (Vorbis encoder), libvpx (VP8 encoder/decoder), and libx264 (H.264 encoder). These are optional and may be omitted if desired. This guide will also install many filters (see the filter list in the [Filtering Guide][1].

Note: Copy and paste the whole code box for each step.

Preparation

@samuelcolvin
samuelcolvin / dns_server.py
Last active November 18, 2023 21:49
requires python 3.5+ and dnslib, see https://github.com/samuelcolvin/dnserver for full/better implementation
from datetime import datetime
from time import sleep
from dnslib import DNSLabel, QTYPE, RD, RR
from dnslib import A, AAAA, CNAME, MX, NS, SOA, TXT
from dnslib.server import DNSServer
EPOCH = datetime(1970, 1, 1)
SERIAL = int((datetime.utcnow() - EPOCH).total_seconds())
# coding=utf-8
"""
LICENSE http://www.apache.org/licenses/LICENSE-2.0
"""
import datetime
import sys
import time
import threading
import traceback
import SocketServer