Skip to content

Instantly share code, notes, and snippets.

View erudenko's full-sized avatar

Jack Rudenko erudenko

View GitHub Profile
@erudenko
erudenko / main.go
Created October 23, 2024 05:15
Go nil interface
package main
import "fmt"
// Processor is an interface that processes data
type Processor interface {
Process() string
}
// NullProcessor is a concrete type that implements Processor
@erudenko
erudenko / main.go
Last active April 18, 2024 20:36
Test go copy
package main
import "fmt"
type A struct {
a [][]string
b []string
}
func main() {
@erudenko
erudenko / middleware.go
Created January 24, 2023 03:08
JWT Middleware
// JWTMiddleware middleware to handle JWT tokens.
func JWTMiddleware(ctx context.Context, jwksURI string, ignorePath []string) func(http.Handler) http.Handler {
options := keyfunc.Options{
Ctx: ctx,
RefreshErrorHandler: func(err error) {
log.Printf("There was an error with the jwt.Keyfunc\nError: %s", err.Error())
},
RefreshInterval: time.Hour,
RefreshRateLimit: time.Minute * 5,
RefreshTimeout: time.Second * 10,
@erudenko
erudenko / main.kt
Created July 21, 2022 10:22
Adnroid interview
const val text1 = "I love big red ballon"
const val expected1 = "I evol gib der nollab"
const val text2 = "I love big red ballon!"
const val expected2 = "I evol gib der nollab!"
fun main() {
val rev1 = reversed(text1)
if (expected1 != rev1) {
System.err.println("The test 1 failed, got: $rev1\nexpected:$expected1\n")
@erudenko
erudenko / keybase.md
Last active September 26, 2020 11:22
keybase.md

jackrudenko

Keybase proof

I hereby claim:

  • I am erudenko on github.
  • I am jackrudenko (https://keybase.io/jackrudenko) on keybase.
  • I have a public key ASBRqcSqa10rm7ErnPSt1c4wUreKyA8o_tnCbrTmDbPnFgo

To claim this, I am signing this object:

#I am heading level 1 ##I am heading level 2

I am bold text I am italic text

blockqoutose blockqoutose

>>nested blockqoutes

@erudenko
erudenko / generator.kt
Last active November 22, 2019 10:51
markdown generator
import com.madappgang.markdown.* // see declarations below
fun result() =
markdown {
h1 {+"I am heading level 1"}
h2 {+"I am heading level 2"}
p {
+"First line of paragraphs"
br() //line break
bold {+"I am bold text"}
@erudenko
erudenko / install.sh
Created November 25, 2016 06:42 — forked from wdullaer/install.sh
Install Latest Docker and Docker-compose on Ubuntu
# Ask for the user password
# Script only works if sudo caches the password for a few minutes
sudo true
# Install kernel extra's to enable docker aufs support
# sudo apt-get -y install linux-image-extra-$(uname -r)
# Add Docker PPA and install latest version
# sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9
# sudo sh -c "echo deb https://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list"
@erudenko
erudenko / gitversion.sh
Created September 22, 2015 09:12
Increment Xcode build number on every commit
git=$(sh /etc/profile; which git)
number_of_commits=$("$git" rev-list HEAD --count)
bundle_version=$number_of_commits
target_plist="$TARGET_BUILD_DIR/$INFOPLIST_PATH"
dsym_plist="$DWARF_DSYM_FOLDER_PATH/$DWARF_DSYM_FILE_NAME/Contents/Info.plist"
for plist in "$target_plist" "$dsym_plist"; do
if [ -f "$plist" ]; then
#import <Foundation/Foundation.h>
@interface NSNull (Test)
@property (readonly) BOOL a;
@property (readwrite) BOOL b;
@end
@implementation NSNull (Test)