Skip to content

Instantly share code, notes, and snippets.

View magicsk's full-sized avatar
🧙‍♂️
Being magic.

magic_sk magicsk

🧙‍♂️
Being magic.
View GitHub Profile
@magicsk
magicsk / exportRealm.sh
Created July 10, 2023 16:43
export realm form bitnami keycloak docker container
/opt/bitnami/keycloak/bin/kc.sh export --dir /docker-entrypoint-initdb.d --realm <realm-name>
@magicsk
magicsk / getObjectPropertyByPath.ts
Created June 15, 2023 12:13
get object property by string path TypeScript
const getObjectPropertyByPath = (object: any, path: string) => {
if (object == null) {
return object
}
const parts = path.split('.')
for (let i = 0; i < parts.length; ++i) {
const part = parts[i]
if (object == null) {
return undefined
}
@magicsk
magicsk / setObjectPropertyByPath.ts
Last active June 15, 2023 12:13
set object property by string path TypeScript
const setObjectPropertyByPath = (object: any, path: string, value: any) => {
const parts = path.split('.')
const limit = parts.length - 1
parts
for (let i = 0; i < limit; ++i) {
const key = parts[i]
if (parts?.[i + 1] === '0') {
value.map((nesttedValue: any, index: number) => {
setObjectPropertyByPath(object[key][index], parts.slice(i + 2).join('.'), nesttedValue)
})
@magicsk
magicsk / tasks.json
Created February 17, 2022 09:19
gcc args for opengl
{
"tasks": [
{
"type": "cppbuild",
"label": "C/C++: gcc build active file",
"command": "/usr/bin/gcc",
"args": [
"-Wall",
"-fdiagnostics-color=always",
"-g",
@magicsk
magicsk / rm_node_modules.sh
Last active January 22, 2022 20:36
remove all node_monules dirs in project recursively
find . -name "node_modules" -print0 | xargs -0 rm -rf
@magicsk
magicsk / update.kt
Last active October 13, 2021 15:38
update list from fragment every second
val thread: Thread = object : Thread() {
override fun run() {
try {
while (!this.isInterrupted) {
sleep(1000)
activity?.runOnUiThread(Runnable {
// tableAdapter.update()
})
}
} catch (e: InterruptedException) {
@magicsk
magicsk / events.kt
Last active August 1, 2021 22:07
kotlin socketio events
.on(Socket.EVENT_CONNECT) { println("connected") }
.on(Socket.EVENT_DISCONNECT) { println("disconnected") }
.on(Socket.EVENT_CONNECTING) { println("connecting") }
.on(Socket.EVENT_CONNECT_ERROR) { println("connect error") }
.on(Socket.EVENT_CONNECT_TIMEOUT) { println("connect timeout") }
.on(Socket.EVENT_ERROR) { println("connect error") }
.on(Socket.EVENT_RECONNECT) { println("reconnect") }
.on(Socket.EVENT_RECONNECTING) { println("reconnecting") }
.on(Socket.EVENT_RECONNECT_ATTEMPT) { println("reconnect attempt") }
.on(Socket.EVENT_RECONNECT_ERROR) { println("reconnect error") }
@magicsk
magicsk / scrollbar.css
Created April 4, 2021 11:03
scrollbar chromium css
::-webkit-scrollbar {
width: 12px!important;
}
::-webkit-scrollbar-track {
background: #333947!important;
}
::-webkit-scrollbar-thumb {
background-color: #838a97!important;
@magicsk
magicsk / radio.dart
Last active June 5, 2021 14:09
radio.dart with inactive color for flutter 2.2.1
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter/widgets.dart';
import 'constants.dart';
import 'debug.dart';
import 'material_state.dart';
import 'theme.dart';
@magicsk
magicsk / mg
Created February 20, 2021 00:16
my own keyboard layout
default partial alphanumeric_keys
xkb_symbols "basic" {
// This layout conforms to a part of Slovak standard
// and my needs, designed to satisfy mostly me.
// 2021 by Rastislav Brna <magicsk@magicsk.eu>
include "latin"
name[Group1] = "magic_sk";