Skip to content

Instantly share code, notes, and snippets.

View ang3lkar's full-sized avatar

Angelos Karagkiozidis ang3lkar

View GitHub Profile
@ang3lkar
ang3lkar / node-typescript-esm.md
Created February 15, 2024 14:32 — forked from khalidx/node-typescript-esm.md
A Node + TypeScript + ts-node + ESM experience that works.

The experience of using Node.JS with TypeScript, ts-node, and ESM is horrible.

There are countless guides of how to integrate them, but none of them seem to work.

Here's what worked for me.

Just add the following files and run npm run dev. You'll be good to go!

package.json

@ang3lkar
ang3lkar / TrueColour.md
Created March 10, 2021 19:22 — forked from XVilka/TrueColour.md
True Colour (16 million colours) support in various terminal applications and terminals

Terminal Colors

There exists common confusion about terminal colors. This is what we have right now:

  • Plain ASCII
  • ANSI escape codes: 16 color codes with bold/italic and background
  • 256 color palette: 216 colors + 16 ANSI + 24 gray (colors are 24-bit)
  • 24-bit true color: "888" colors (aka 16 milion)
@ang3lkar
ang3lkar / semversort.sh
Last active August 14, 2020 13:02 — forked from andkirby/semversort.sh
Semantic versions sorting in bash.
#!/usr/bin/env bash
# Download this gist
# curl -Ls https://gist.github.com/ang3lkar/bc14f3a8abf1197c6889d5bea92511f1/raw/semversort.sh | bash
# And run:
# $ semversort 1.0 1.0-rc 1.0-patch 1.0-alpha
# or in GIT
# $ semversort $(git tag)
# Using pipeline:
# $ echo 1.0 1.0-rc 1.0-patch 1.0-alpha | semversort
#
@ang3lkar
ang3lkar / console.rb
Created November 25, 2019 09:32
Benchmark Rails middleware
# Open an Rails console and paste these below.
# (exit and open another in case of edit)
noop = Proc.new {[200, {}, ["hello"]]}
request = Rack::MockRequest.new(noop)
Rails.configuration.middleware = Rails.configuration.middleware.dup
Benchmark.ips do |x|
x.config(time: 250, warmup: 5)
@ang3lkar
ang3lkar / announcement.md
Last active September 9, 2019 10:30
Rails Upgrade

Ruby Upgrade

Dear people, as you may already know we transcend to the Rails5 era! Rails 5 required a Ruby upgrade so, apart from the new Rails APIs, we jumped from Ruby 2.3.8 to 2.6.3!

Apart from many performance improvements with less memory consumption, this gives us several goodies we can use from now on.

How to upgrade

brew install libidn
rvm install ruby-2.6.3
sudo gem update --system 2.6.3
@ang3lkar
ang3lkar / gcrgc.sh
Created April 23, 2019 15:43 — forked from ahmetb/gcrgc.sh
Script to clean up Google Container Registry images pushed before a particular date
#!/bin/bash
# Copyright © 2017 Google Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
@ang3lkar
ang3lkar / search.sh
Last active March 29, 2019 16:03
Find the unused ENV variables in your Rails app
# All variable names in a nice convenient file, each one in a separate line:
# heroku config --app <app> | awk '{print $1}' | sed s/:$//g >> env_variables.txt
# or
# cat .env | awk -F= '{print $1}' | sed '/^#/ d' | sed s/:$//g | sort >> env_variables.txt
variables=`cat env_variables.txt`
# new array
declare -a zombie_variables
@ang3lkar
ang3lkar / parse.js
Last active March 27, 2019 15:30
Export our Heroku scheduler jobs into the k8s equivalent configuration
// Save page as HTML and add JQuery for convenience
arr = []
$('.item_well').each((index, element) => {
arr[index] = {}
let dyno = $(element).find('div.dyno_size option:selected').text()
let job = $(element).find('input.input--code')[0].value

How we incorporate next and cloudfront (2018-04-21)

Feel free to contact me at robert.balicki@gmail.com or tweet at me @statisticsftw

This is a rough outline of how we utilize next.js and S3/Cloudfront. Hope it helps!

It assumes some knowledge of AWS.

Goals

@ang3lkar
ang3lkar / Gemfile
Created July 25, 2018 21:37 — forked from janko/Gemfile
Memory profiling of http.rb and other popular Ruby HTTP client libraries
source "https://rubygems.org"
gem "roda"
gem "http", "~> 3.3"
gem "rest-client"
gem "httparty"