Skip to content

Instantly share code, notes, and snippets.

View aperkaz's full-sized avatar
🚀
In the zone

Alain Perkaz aperkaz

🚀
In the zone
View GitHub Profile
@aperkaz
aperkaz / CommandCheatsheet.md
Last active February 6, 2018 11:31
Ubuntu command cheat-sheet

Ubuntu Command Cheatsheet

General usage ubuntu comments. Separated in general and development related.

General

General scope useful commands

  • Sync VM machine time
sudo ntpdate ntp.ubuntu.com
@aperkaz
aperkaz / DockerDevelopment.MD
Last active February 23, 2018 19:04
Docker Development

Docker Development

Short gist with Node development using Docker.

Effimeral container (with bash)

Span a Node docker container and connect into it.

Features

  • Mount bolume that will be removed on leave: -it --rm
@aperkaz
aperkaz / JSDecorators.md
Last active January 6, 2018 17:56
JS Decorators in React

JS Decorators in React

Short practical guide to clarify the use cases of Decorators (aka HOF) and High Order Components. The examples is applicable for general JS, but are contructed using ES2015 + React.

Higher Order Functions and Higher Order Components

Higher Order Functions (HOF) are functions that receive functions as arguments (Inception :/) and return functions. They operate over functions instead of "simple" variables. Decorators provide syntactic suggar for implementing HOFs JS, to modify and extend passed functions.

Higher Order Components (HOC) are a React specific patter, very much similar to the aforemntioned HOF. Instead of receiving functions as argumnets, Components are passed. They are especially useful to add stateful wrappers to componets and alter livecycle

@aperkaz
aperkaz / .config__redshift.conf
Created May 29, 2018 13:24
Redshift config
; Global settings for redshift
[redshift]
; Set the day and night screen temperatures
temp-day=5300
temp-night=3500
; Enable/Disable a smooth transition between day and night
; 0 will cause a direct change from day to night screen temperature.
; 1 will gradually increase or decrease the screen temperature.
transition=1
@aperkaz
aperkaz / backup.md
Created June 15, 2018 14:15
Linux Backup

Hotkeys

Save to file

dconf dump /org/gnome/desktop/wm/keybindings/ > keybindings.dconf

Load from file

dconf load /org/gnome/desktop/wm/keybindings/ < keybindings.dconf
@aperkaz
aperkaz / linux-scaling.md
Last active June 15, 2018 23:48
Linux scaling

Linux Scaling

Force scaling of applications when in HiDPI screens.

Add to the command, X being the scale factor:

--force-device-scale-factor=X

Example, execute Spotify with 2x scaling:

@aperkaz
aperkaz / settings.json
Created March 14, 2019 14:36
VS configuration
{
"window.title": "${dirty} ${activeEditorMedium}${separator}${rootName}",
"editor.formatOnPaste": true,
"editor.fontFamily": "Operator Mono",
"terminal.integrated.fontFamily": "Fira Code",
"terminal.integrated.fontSize": 14,
"terminal.integrated.lineHeight": 1.5,
"editor.fontSize": 18,
"editor.renderWhitespace": "boundary",
"editor.autoIndent": true,
@aperkaz
aperkaz / ergodox_ez_test-layout-7_yeyJ.hex
Created April 15, 2019 12:36
Ergodox-ez configuration
:100000000C94C3030C94E0030C94E0030C94E00301
:100010000C94E0030C94E0030C94E0030C94E003D4
:100020000C94E0030C94E0030C942C2B0C94FE2B0A
:100030000C9492230C94E0030C94E0030C94E003E2
:100040000C94E0030C94E0030C94E0030C94E003A4
:100050000C94E0030C94FA230C94E0030C94E0035A
:100060000C94E0030C94E0030C94E0030C94E00384
:100070000C94E0030C94E0030C94E0030C94E00374
:100080000C94E0030C94E0030C94E0030C94E00364
:100090000C94E0030C94E0030C94E0030C94E00354
@aperkaz
aperkaz / Functional JS binary search.js
Last active April 30, 2019 07:31
Code kata 1 - CodeHub
const INVALID = -1;
const binarySearch = (target, arr) => {
const start = 0;
const finish = arr.length - 1;
const middle = Math.floor((start + finish) / 2);
console.log(arr);
console.log('middle value: ',arr[middle]);
@aperkaz
aperkaz / index.js
Created June 23, 2020 10:03
Get host lat-long in electron.js
(async () => {
const got = require("got");
const publicIp = require("public-ip");
// get public ip
const publicIpV4 = await publicIp.v4();
// get location from ip
try {
const response = await got(`http://ip-api.com/json/${publicIpV4}`);