Skip to content

Instantly share code, notes, and snippets.

View apostergiou's full-sized avatar
🌊
Focusing

Apostolis Stergiou apostergiou

🌊
Focusing
View GitHub Profile
@apostergiou
apostergiou / LLM.md
Created March 30, 2023 13:49 — forked from rain-1/LLM.md
LLM Introduction: Learn Language Models

Purpose

Bootstrap knowledge of LLMs ASAP. With a bias/focus to GPT.

Avoid being a link dump. Try to provide only valuable well tuned information.

Prelude

Neural network links before starting with transformers.

@apostergiou
apostergiou / attributes.rb
Created April 23, 2019 15:30 — forked from lizthegrey/attributes.rb
Hardening SSH with 2fa
default['sshd']['sshd_config']['AuthenticationMethods'] = 'publickey,keyboard-interactive:pam'
default['sshd']['sshd_config']['ChallengeResponseAuthentication'] = 'yes'
default['sshd']['sshd_config']['PasswordAuthentication'] = 'no'
@apostergiou
apostergiou / test_mail_purge.rb
Created April 1, 2019 13:22 — forked from adamsanderson/test_mail_purge.rb
An example of using MiniTest::Mock
require 'minitest/mock'
require 'minitest/unit'
require 'date'
MiniTest::Unit.autorun
class TestMailPurge < MiniTest::Unit::TestCase
class MailPurge
def initialize(imap)
@imap = imap
Git Actions: CI System Actions:
+-------------------------+ +-----------------+
+--► Create a Feature Branch | +---► Build Container |
| +------------+------------+ | +--------+--------+
| | | |
| | | |
| +--------▼--------+ | +-------▼--------+
| +---► Push the Branch +-------+ | Push Container |
| | +--------+--------+ +-------+--------+
@apostergiou
apostergiou / go-kit.md
Created February 19, 2019 15:29 — forked from posener/go-kit.md
Why I Recommend to Avoid Using the go-kit Library

Why I Recommend to Avoid Using the go-kit Library

There is a trending 'microservice' library called go-kit. I've been using the go-kit library for a while now. The library provide a lot of convenience integrations that you might need in your service: with service discovery with Consul, distributed tracing with Zipkin, for example, and nice logic utilities such as round robin client side load balancing, and circuit breaking. It is also providing a way to implement communication layer, with support of RPC and REST.

@apostergiou
apostergiou / gist:d43948a9b43d3535a796ca46234710fa
Created December 27, 2018 11:34 — forked from kingbin/gist:9435292
Manually Start/Stop PostgresSQL on Mac
# Stop PostgreSQL from auto starting
sudo launchctl unload -w /Library/LaunchDaemons/com.edb.launchd.postgresql-9.3.plist
# Enable PostgreSQL to auto start
sudo launchctl load -w /Library/LaunchDaemons/com.edb.launchd.postgresql-9.3.plist
# Start postgres
$ sudo su postgres
Password:
bash-3.2$ pg_ctl -D /Library/PostgreSQL/9.3/data/ start
@apostergiou
apostergiou / backtrace.rb
Created September 25, 2018 12:41
ruby print backtrace
rescue_from StandardError do |exception|
# Handle only JSON requests
raise unless request.format.json?
err = {error: exception.message}
err[:backtrace] = exception.backtrace.select do |line|
# filter out non-significant lines:
%w(/gems/ /rubygems/ /lib/ruby/).all? do |litter|
not line.include?(litter)
@apostergiou
apostergiou / Makefile
Created September 12, 2018 14:37 — forked from ahawkins/Makefile
Example Makefile
RUBY_IMAGE:=$(shell grep FROM Dockerfile | cut -f2 -d' ')
DYNAMODB_IMAGE:=dynamodb:latest # original value ommitted
APP_IMAGE:=inventory_service/app
TAG:=$(shell git rev-parse --short HEAD)
REGISTRY:=example.registry.com # original value omitted
.DEFAULT_GOAL:= build
@apostergiou
apostergiou / rubymethodlookup.md
Created May 13, 2018 07:02 — forked from damien-roche/rubymethodlookup.md
A Primer on Ruby Method Lookup

A Primer on Ruby Method Lookup

Method lookup is a simple affair in most languages without multiple inheritance. You start from the receiver and move up the ancestors chain until you locate the method. Because Ruby allows you to mix in modules and extend singleton classes at runtime, this is an entirely different affair.

I will not build contrived code to exemplify the more complicated aspects of Ruby method lookup, as this will only serve to confuse the matter. If you are having trouble following method lookup in your own programs, it is not because Ruby has strange rules (it does), it is because your code is too tangled.

When you pass a message to an object, here is how Ruby finds what method to call:

1. Look within singleton class

@apostergiou
apostergiou / web-servers.md
Created May 1, 2018 19:13 — forked from willurd/web-servers.md
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000