Skip to content

Instantly share code, notes, and snippets.

View MrAndrewMal's full-sized avatar
🏠
Working from home

André MrAndrewMal

🏠
Working from home
View GitHub Profile
@MrAndrewMal
MrAndrewMal / filter-items
Last active July 24, 2022 07:30
Filter array items by choosen fields
const users = [
{
id: 1,
name: 'Leanne Graham',
username: 'Bret',
email: 'Sincere@april.biz',
},
{
id: 2,
name: 'Ervin Howell',
@MrAndrewMal
MrAndrewMal / robbyrussell.zsh_theme
Created November 28, 2021 12:59 — forked from mikehazell/robbyrussell.zsh_theme
oh-my-zsh Default Theme plus Node version info
# oh-my-zsh Theme
# Default robbyrussell theme with node version info.
# Installation: place this file in .oh-my-zsh/custom/themes/robbyrussell.zsh_theme
function node_prompt_version {
if which node &> /dev/null; then
echo "%{$fg_bold[blue]%}node(%{$fg[red]%}$(node -v)%{$fg[blue]%}) %{$reset_color%}"
fi
}
@MrAndrewMal
MrAndrewMal / promise-tuple.js
Created October 14, 2021 15:22 — forked from fnky/promise-tuple.js
Retrieve tuples from Promise results / async functions
/**
* Returns a Promise which resolves with a value in form of a tuple.
* @param promiseFn A Promise to resolve as a tuple.
* @returns Promise A Promise which resolves to a tuple of [error, ...results]
*/
export function tuple (promise) {
return promise
.then((...results) => [null, ...results])
.catch(error => [error])
}
@MrAndrewMal
MrAndrewMal / auto_fs_pi.txt
Created January 21, 2021 20:54 — forked from solaris9000/auto_fs_pi.txt
How to set up auto filesystem expansion for custom PI images
How to set up auto filesystem expansion for custom PI images
============================================================
Preamble
========
When a custom pi image is created, it is a good idea to expand the FS so that all the space on the SD card is used. This is done manaully using the raspi-config tool or raspi-config --expand-rootfs.
The official pi images expand the FS automatically so it would be nice to replicate this process for custom images.
The procedure below shows how to do this.
Procedure
@MrAndrewMal
MrAndrewMal / journalctl.txt
Last active December 8, 2023 00:55
How to read live-tail logs of multiple services with journalctl
#Systemd - How to read live-tail logs of multiple services with journalctl
sudo journalctl --follow _SYSTEMD_UNIT=docker.service + _SYSTEMD_UNIT=apache2.service
@MrAndrewMal
MrAndrewMal / tizen.sh
Created November 28, 2020 23:47 — forked from laat/tizen.sh
Notes on Tizen commands that might work
sdb connect <ip>:<port> # connect to TV
sdb -s <deviceName> capability # get <installationPath>
# build
tizen cli-config "default.profiles.path=<profile_path>"
tizen build-web -out .buildResult -- <source-dir>
tizen package --type wgt --sign profileName -- <source-dir>/.buildResult # extract <package-file>
mv <package-file> .
rm -rf <source-dir>/.buildResult
@MrAndrewMal
MrAndrewMal / Инструменты_разработчика_в_SmartTV.md
Created November 28, 2020 23:42 — forked from kicumkicum/Инструменты_разработчика_в_SmartTV.md
План доклада об инструментов отладки Smart TV приложений

Идея

Отладка SmartTV больная тема для большинства разработчиков. Мысли о том, что придется делать все в слепую отталкивают разработчиков, что негативно влияет на отрасль SmartTV и Web в целом. Я рассказажу, что не все так плохо и инструменты существуют. А те, которых нет не сложно запилить самому.

Официальные средства

@MrAndrewMal
MrAndrewMal / Setup Raspberry Pi OS Image Script.md
Created October 19, 2020 19:29 — forked from cinderblock/Setup Raspberry Pi OS Image Script.md
Scripts to setup a Raspberry Pi OS image **before** flashing to SD card

Setup Raspberry Pi OS Image Script

Scripts for modifying Raspberry Pi OS images before writing to SD card.

  • QEMU - setup on x86 (faster)
  • chroot
  • Setup script. Set:
    • hostname
    • WiFi
  • ssh keys
@MrAndrewMal
MrAndrewMal / client.js
Created June 23, 2020 17:10 — forked from jchillerup/client.js
remote reloading of web content with socket.io and node
var socket = io.connect('http://HOSTNAME:8080');
socket.on('reload', function (data) {
location.reload();
});
/*
socket.on('eval', function(data) {
eval(data.evalString);
});
@MrAndrewMal
MrAndrewMal / window-height-width.js
Created June 7, 2020 20:56 — forked from joshcarr/window-height-width.js
vanilla JS window width and height
// vanilla JS window width and height
var w=window,
d=document,
e=d.documentElement,
g=d.getElementsByTagName('body')[0],
x=w.innerWidth||e.clientWidth||g.clientWidth,
y=w.innerHeight||e.clientHeight||g.clientHeight;