Skip to content

Instantly share code, notes, and snippets.

View katsos's full-sized avatar

Nikos Katsos katsos

View GitHub Profile
@katsos
katsos / mbgl.js
Created February 1, 2024 23:40
Bare Minimum - Mapbox gl js layer example
map.current.on('load', function () {
map.current.addLayer({
id: 'places',
type: 'circle',
source: {
type: 'geojson',
data: {
type: 'Feature',
geometry: {
type: 'Point',
@katsos
katsos / hyperv.bat
Created August 24, 2023 12:07
Hyper-V Fullscreen (2k resolution)
Set-VMVideo -VMName "Ubuntu 22" -HorizontalResolution 2560 -VerticalResolution 1440 -ResolutionType Single
@katsos
katsos / spotify_scrapping.js
Created February 1, 2022 10:17
Scrap Spotify Playlists - UNDER DEVELOPMENT
artist = "rq2VQ5mb9SDAFWbBIUIn"
song = "t_yrXoUO3qGsJS4Y6iXX"
Array.from(document.querySelectorAll('[role="row"]'))
.map(v => `${v.querySelector(`.${artist}`)?.innerText} ${v.querySelector(`.${song}`)?.innerText}`);
@katsos
katsos / dry.js
Created January 27, 2022 12:08
How to DRY with es6
const a = 'asdf';
const q = 'qwerty';
// instead of
// aCalculated =
// qCalculated =
const [aCalculated, qCalculated] = [a, q].map(v => someComplexFunction(v));
// or [a, q].map(someComplexFunction) for short
@katsos
katsos / numbers.js
Created January 27, 2022 12:04
Array of numbers in es6
const numbers = [...Array(n).keys()];
// [1, 2, 3... n]
@katsos
katsos / erm.py
Last active December 2, 2021 21:51
earthquake relative magnitude
import pandas as pd
def calculate(catalogue, min_magnitude):
df = pd.read_excel(f'./data/catalogue{catalogue}.xlsx', sheet_name=None)
print(df)
for sheet_name in df.keys():
calculate_per_sheet(df[sheet_name], sheet_name, min_magnitude)
@katsos
katsos / .zshrc
Created November 4, 2021 10:52
Command not found - node_module in path
PATH=$PATH:node_modules/.bin
@katsos
katsos / deiktis-timon-sort-by-price.js
Last active August 26, 2021 11:07
spitogatos.gr/deiktis-timon | sort by ascending current price
let z = Array.from(document.querySelector('#table_sale_container').querySelectorAll('tr')).slice(1)
.map(v => {
const [region, price] = Array.from(v.querySelectorAll('td')).map(v => v.innerText);
const _price = Number(price.replace('.',''));
return {
region,
price: _price,
ex50: (_price * 50)};
})
@katsos
katsos / new_context_menu_fix.reg
Created July 14, 2021 23:49
Windows 10 - When new option is missing from context menu or "New Folder" button doesn't work
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Directory\Background\shellex\ContextMenuHandlers\New]
@="{D969A300-E7FF-11d0-A93B-00A0C90F2719}"
@katsos
katsos / unzip_all_flat.sh
Created December 18, 2020 00:55
Unzip all .zip files of a folder flat
unzip -j \*.zip