Skip to content

Instantly share code, notes, and snippets.

View mjarkk's full-sized avatar

Mark Kopenga mjarkk

View GitHub Profile
<?php
function max_mem_usage()
{
$bytes = memory_get_peak_usage();
$units = array('B', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB');
$mod = 1024;
$power = $bytes > 0 ? floor(log($bytes, $mod)) : 0;
return sprintf('%01.2f %s', $bytes / pow($mod, $power), $units[$power]);
}
@mjarkk
mjarkk / s9_adb_change_resolution.sh
Created November 11, 2022 21:17
Change the screen resolution of the samsung galaxy s9 using adb
adb shell
# Most battery efficent
wm size 720x1480
wm density 280
# Original
wm size 1440x2960
wm density 560
@mjarkk
mjarkk / app.sh
Created December 4, 2020 15:23
brioche app in brioche shell
#!/bin/bash
if [ -z "$CONTAINER_GPU" ]; then CONTAINER_GPU=0; fi
echo "#!/bin/bash" > ~/.brioche_last_app.sh
echo "xhost +" >> ~/.brioche_last_app.sh
echo "/usr/bin/start-pulseaudio-x11" >> ~/.brioche_last_app.sh
echo "${@:1}" >> ~/.brioche_last_app.sh
chmod 0755 ~/.brioche_last_app.sh
@mjarkk
mjarkk / My chrome os dev setup.md
Last active August 9, 2021 09:29
My chrome os dev setup

Ran on my Dell XPS 15 9560 (4k) using brunch with the rammus recovery

Why?

Mostly funs.

Findings

Great things:

  • Battery seem to be better than linux, equal to windows.
  • With normal usage laptops doesn't get hot even while wathcing 4k videos on youtube. Note that this also results in way less often the fan ramping up :)
  • Crostini works great and is by default setup to passtough localhost.

My gentoo cheet sheet

Install vscode

sudo emerge eselect-repository
sudo eselect repository enable pentoo
sudo emaint sync -r pentoo
su -c 'echo "app-editors/visual-studio-code ~amd64" >> /etc/portage/package.accept_keywords'
sudo emerge app-editors/visual-studio-code

A cheatsheet for installing FreeBSD

Corsair keyboard not working

Press the win key lock + F1 for 3 seconds. (this puts the keyboard in some kind of special mode where it behaves like an old keyboard)

Deafult programs

pkg install vim nano sudo

visudo
@mjarkk
mjarkk / windows_dev_station.md
Last active April 19, 2020 19:00
How i use windows for development

screenshot
Background: crowned > need for speed, Fluent terminal with Bright Lights theme

My Windows dev setup / howto

Rambelings

Ya windows the worst os to program on or is it.
For a long time i've been fully againced windows and i still kinda agree if you use it without "cheating". Windows it just too unstable and too un-standardized to work with on it's own, it's like using mac os with it's forever taking updates but combined with non-standardized tooling and a lot of unexpected bahavior what just results in a lot of frustration.
For example why can i see ls taking time to display lines in powershell???, ya it's only ~50ms but still why does a simple command like ls has to take so long??
Or why sometimes do programs not stop running when i press ctrl+c and do i need to open task manager and scroll to the program because there is no search bar so i can find it quickly??

@mjarkk
mjarkk / log.go
Last active June 3, 2020 12:48
a small go file for quickly logging things in tui applications
package
import (
"fmt"
"os"
)
func l(v ...interface{}) {
f, _ := os.OpenFile("debug.log", os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666)
fmt.Fprintln(f, v...)
@mjarkk
mjarkk / gpg_keys.sh
Created October 18, 2019 14:36
A cheat sheet for my gpg keys
# Import my key (mjarkk@paranoid.email)
curl https://keybase.io/mjarkk/pgp_keys.asc | gpg --import

Keybase proof

I hereby claim:

  • I am mjarkk on github.
  • I am mjarkk (https://keybase.io/mjarkk) on keybase.
  • I have a public key whose fingerprint is 75D1 0043 D24C 1560 463F 3621 E5E3 30D0 DBBE 5AA9

To claim this, I am signing this object: