Skip to content

Instantly share code, notes, and snippets.

View ang3lkar's full-sized avatar

Angelos Karagkiozidis ang3lkar

View GitHub Profile
@ang3lkar
ang3lkar / boot.rb
Last active September 8, 2015 16:04 — forked from chuckbergeron/boot.rb
One Database Per Branch, Per Environment
CURRENT_BRANCH = `git status | head -1`.to_s.gsub('On branch ','').chomp
@ang3lkar
ang3lkar / vim_cheatsheet.md
Created January 26, 2016 11:00 — forked from awidegreen/vim_cheatsheet.md
Vim shortcuts

Introduction

  • C-a == Ctrl-a
  • M-a == Alt-a

General

:q        close
:w        write/saves
:wa[!]    write/save all windows [force]
:wq       write/save and close
@ang3lkar
ang3lkar / README.md
Created March 4, 2016 14:25 — forked from derwiki/README.md
Ruby module that you can use in a `before_action` on sensitive controllers for which you'd like a usage audit trail

Adding an audit log to your Rails app

If you have any sort of administrative interface on your web site, you can easily imagine an intruder gaining access and mucking about. How do you know the extent of the damage? Adding an audit log to your app is one quick solution. An audit log should record a few things:

  • controller entry points with parameter values
  • permanent information about the user, like user_id
  • transient information about the user, like IP and user_agent

Using the Rails framework, this is as simple as adding a before_action to your admin controllers. Here’s a basic version that I’m using in production.

@ang3lkar
ang3lkar / active_model_serializers.rb
Created July 9, 2018 09:06 — forked from pdabrowski6/active_model_serializers.rb
BENCHMARKS: How to create fast JSON serialization in Rails?
# post_serializer.rb
class PostSerializer < ActiveModel::Serializer
has_many :comments
attributes :id, :title, :content
end
# comment_serializer.rb
@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"

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 / 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 / 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 / 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 / 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