Skip to content

Instantly share code, notes, and snippets.

View vovahost's full-sized avatar

Vlad vovahost

  • London
View GitHub Profile
@ecyshor
ecyshor / proxy.ts
Last active March 8, 2023 04:36
nodejs reverse proxy google cloud function
import * as functions from 'firebase-functions';
import * as http from 'http';
const BUCKET_NAME = "target-bucket"
// check original code idea https://stackoverflow.com/a/10435819
exports.rewriteGCSRequest = functions.https.onRequest((oreq: any, ores: any) => {
const redirectPath = oreq.originalUrl === '/' ? '/index.html' : oreq.originalUrl
const options = {
// host to forward to
@manuelvicnt
manuelvicnt / AnAndroidApp.kt
Last active January 1, 2023 17:05
Hilt and AssistedInject working together in Hilt v2.28-alpha times - ViewModel version
// IMPORTANT! READ THIS FIRST
// Assisted Injection doesn't work with @HiltViewModel or @ViewModelInject
// Read more about the issue here: https://github.com/google/dagger/issues/2287
//
//
// AssistedInject and Hilt working together in v2.28-alpha times
// Example of a ViewModel using AssistedInject injected in a Fragment by Hilt
// As AssistedInject isn't part of Dagger yet, we cannot use in
// conjuction with @ViewModelInject
@slightfoot
slightfoot / MainActivity.java
Created April 2, 2020 12:55
Draw Under System Ui in Flutter
import android.os.Build;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import io.flutter.app.FlutterActivity;
import io.flutter.plugins.GeneratedPluginRegistrant;
public class MainActivity extends FlutterActivity
@slightfoot
slightfoot / page_turn.dart
Created September 9, 2019 21:28
Page Turn Effect - By Simon Lightfoot. Replicating this behaviour. https://www.youtube.com/watch?v=JqvtZwIJMLo
// MIT License
//
// Copyright (c) 2019 Simon Lightfoot
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
@vlio20
vlio20 / StatusCode.kt
Last active June 19, 2023 23:56
Kotlin Http Status Codes enum
package oogaday.commons.enums
enum class StatusCode(val code: Int) {
Continue(100),
SwitchingProtocols(101),
Processing(102),
OK(200),
Created(201),
Accepted(202),
@Col-E
Col-E / SmoothishScrollpane.java
Created June 24, 2018 23:59
JavaFX ScrollPane with smooth scrolling
import javafx.animation.Animation.Status;
import javafx.animation.Interpolator;
import javafx.animation.Transition;
import javafx.event.EventHandler;
import javafx.scene.Node;
import javafx.scene.control.ScrollPane;
import javafx.scene.input.ScrollEvent;
import javafx.scene.layout.VBox;
import javafx.util.Duration;
@takahirom
takahirom / EventBus.kt
Last active June 8, 2024 14:09
EventBus by Kotlin coroutine
import kotlinx.coroutines.experimental.channels.BroadcastChannel
import kotlinx.coroutines.experimental.channels.ConflatedBroadcastChannel
import kotlinx.coroutines.experimental.channels.ReceiveChannel
import kotlinx.coroutines.experimental.channels.filter
import kotlinx.coroutines.experimental.channels.map
import kotlinx.coroutines.experimental.launch
import javax.inject.Inject
import javax.inject.Singleton
@markscottwright
markscottwright / convert to pkcs 8.md
Last active June 23, 2022 14:06
How to convert a java private key from PKCS#1 encoding to PKCS#8

I had some historical key material data in pkcs#1 format that needed to be in pkcs#8 for input into another system. Here's how to do it, using BouncyCastle:

import org.bouncycastle.asn1.ASN1InputStream;
import org.bouncycastle.asn1.DERObject;
import org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers;
import org.bouncycastle.asn1.pkcs.PrivateKeyInfo;
import org.bouncycastle.asn1.x509.AlgorithmIdentifier;
import java.security.PrivateKey;
@ppisarczyk
ppisarczyk / Programming_Languages_Extensions.json
Last active June 19, 2024 09:50 — forked from aymen-mouelhi/languages.json
Programming Languages and their File Extensions
[
{
"name":"ABAP",
"type":"programming",
"extensions":[
".abap"
]
},
{
"name":"AGS Script",
@yuhki50
yuhki50 / intArray2byteArray.kt
Last active January 4, 2024 17:47
Kotlin intArray to byteArray
val ints = intArrayOf(0x01, 0xFF)
val bytes = ints.foldIndexed(ByteArray(ints.size)) { i, a, v -> a.apply { set(i, v.toByte()) } }