Skip to content

Instantly share code, notes, and snippets.

View minlaxz's full-sized avatar
:octocat:
👻

Min Min Latt minlaxz

:octocat:
👻
View GitHub Profile
@minlaxz
minlaxz / 10-Bit H.264
Created May 13, 2021 04:58 — forked from YamashitaRen/10-Bit H.264
10-Bit H.264 explanation
10-Bit H.264
For all those who haven’t heard of it already, here’s a quick rundown about the
newest trend in making our encodes unplayable on even more systems: So-called
high-bit-depth H.264. So, why another format, and what makes this stuff
different from what you know already?
First off: What is bit depth?
In short, bit depth is the level of precision that’s available for storing color
information. The encodes you’re used to have a precision of 8 bits (256 levels)
@minlaxz
minlaxz / vino-nano-serve.sh
Created July 4, 2021 17:48
Starting Vino server on Jetson nano.
#!/bin/bash
export DISPLAY=:0
gsettings set org.gnome.Vino enabled true
gsettings set org.gnome.Vino prompt-enabled false
gsettings set org.gnome.Vino require-encryption false
/usr/lib/vino/vino-server &
@minlaxz
minlaxz / git_submodules.md
Created July 22, 2021 14:18 — forked from gitaarik/git_submodules.md
Git Submodules basic explanation

Git Submodules basic explanation

Why submodules?

In Git you can add a submodule to a repository. This is basically a repository embedded in your main repository. This can be very useful. A couple of advantages of using submodules:

  • You can separate the code into different repositories.
@minlaxz
minlaxz / open_source_licenses.md
Created September 17, 2021 07:32 — forked from nicolasdao/open_source_licenses.md
What you need to know to choose an open source license.
@minlaxz
minlaxz / clean-up-repo-size.md
Last active October 26, 2021 05:29
Cleaning up a git repo for reducing the repository size

Check git repo size : git count-objects -v

First checkout to the commit, which you want to make as the initial commit. Then run the following commands :

git checkout --orphan temp_branch
git add -A
git commit -am "Initial commit message"
git branch -D main
git branch -m main
@minlaxz
minlaxz / CompletelyRemoveAFileFromGitHistory.md
Created November 12, 2021 15:12
Completely remove a file from Git history

I am removing .env file from local git history.

git filter-branch --index-filter "git rm -rf --cached --ignore-unmatch .env" HEAD

To push this to remote,

git push --force

@minlaxz
minlaxz / mro.py
Created December 22, 2021 03:18
Method resolution order in Python - MRO
class Base(object):
def __init__(self):
print("Base init'ed")
class ChildA(Base):
def __init__(self):
print("ChildA init'ed")
Base.__init__(self)
class ChildB(Base):
@minlaxz
minlaxz / memorySizeOfObject.js
Created January 17, 2022 08:05
calculate memory size of javascript object, it is not a accurate value!
function memorySizeOf(obj) {
var bytes = 0;
function sizeOf(obj) {
if(obj !== null && obj !== undefined) {
switch(typeof obj) {
case 'number':
bytes += 8;
break;
case 'string':
@minlaxz
minlaxz / README.md
Created February 8, 2022 03:33 — forked from lucianoratamero/README.md
Using Vite with Django, the simple way

Using Vite with Django, the simple way

This gist has most of the things I've used to develop the frontend using vite inside a monolithic django app.

A couple of things to note:

  • it runs in SPA mode by default. If you want SSR, you may want to look into django_vite;
  • static files unrelated to your app, like images or fonts, should be served by django, instead of imported directly inside your frontend app;
  • you'll need to enable manifest in your vite configs for production;
  • I've only tested this with a React app, but I'll share my notes when testing with a Svelte app later.
@minlaxz
minlaxz / multipleImageContentReader.js
Created February 20, 2022 11:11 — forked from resistancecanyon/multipleImageContentReader.js
Reading Multiple Image Base64 data using Es6 Async/Await in a html:type:file input
// html
// <input type="file" onchange="imagesSelected" multiple accept=".gif,.jpg,.jpeg,.png" />
async function imagesSelected(event) {
let files = [...event.target.files];
let images = await Promise.all(files.map(f=>{return readAsDataURL(f)}));
//all images' base64encoded data will be available as array in images
}
function readAsDataURL(file) {