Skip to content

Instantly share code, notes, and snippets.

View falexandrou's full-sized avatar

Fotis Alexandrou falexandrou

View GitHub Profile
@falexandrou
falexandrou / stackmate-sample.yml
Created March 29, 2022 20:17
Sample stackmate YAML file
---
# Basic configuration
name: awesome-nodejs-project # The project's name
provider: aws # Which cloud provider to use
region: eu-central-1 # The default region to deploy to
# Terraform state storage
state:
bucket: project-name # Use a private, encrypted S3 bucket to store the state
@falexandrou
falexandrou / docker-daemon.sh
Created April 14, 2021 23:18
Run docker daemon via SSH
# You can use a docker daemon via SSH
# Here's how you'd run a container via SSH
$ docker -H ssh://<username>:<server> -it alpine date
# For convenience, this can be aliased as follows:
# (I use rdocker — as in remote docker)
$ alias rdocker="docker -H myusername@myserver"
# Example:
$ rdocker run -it alpine date
with ThreadPoolExecutor(max_workers=os.cpu_count()) as executor:
futures = executor.map(process_func, plays)
for future in as_completed(futures, timeout=None):
failures += 1 if future.exception() else 0
executor.shutdown(wait=True)
@falexandrou
falexandrou / nginx.error.log
Created October 17, 2019 10:13
gremlin nginx.error.log
2019/10/15 09:53:18 [info] 27513#27513: *11173 epoll_wait() reported that client prematurely closed connection, so upstream connection is closed too while sending request to upstream, client: 87.203.202.157, server: gremlin.gr, request: "GET /rails/active_storage/representations/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBKdz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--7abbc1583ddcc70ffe7227afc6a6adc01bd6514d/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdCam9MY21WemFYcGxTU0lNT0RBd2VEZ3dNQVk2QmtWVSIsImV4cCI6bnVsbCwicHVyIjoidmFyaWF0aW9uIn19--a0d4840ae89f302d71bd86190481033bd87e685a/C21444_FW18_PureMove_Bra_Graphics_Pack_07_rgb_vbp__002-1255x742.jpg HTTP/1.1", upstream: "http://unix:///var/www/gremlin/shared/tmp/sockets/puma.sock:/rails/active_storage/representations/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBKdz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--7abbc1583ddcc70ffe7227afc6a6adc01bd6514d/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdCam9MY21WemFYcGxTU0lNT0RBd2VEZ3dNQVk2QmtWVSIsImV4cCI6bnVsbCwicHVyIjoidmFyaWF0aW9uIn19--a0d4840ae89f302d71bd86190
@falexandrou
falexandrou / sendfile.sh
Last active October 16, 2019 06:34
Turn Sendfile to "off" for vagrant boxes
# A VirtualBox bug forces vagrant to serve
# corrupt files via Apache or nginx
# The solution to that would be to turn off
# the SendFile option in apache or nginx
#
# If you use apache as your main web server
# add this directive in your httpd.conf (or apache.conf)
# configuration file name may vary in various systems
#
EnableSendfile off
@falexandrou
falexandrou / swap.sh
Created August 14, 2019 15:25
Create Swap Ubuntu 16.08
# How To Add Swap Space on Ubuntu 18.04
#
# Check out https://stackmate.io and find out how this (and much more) can be done automatically for you
# Before you run this script, please check that swap is not enabled with the following command:
# sudo swapon --show
# If it shows some output, then you probably don't need to run this script anymore
# We're allocating 8GB of swap
sudo fallocate -l 8G /swapfile
@falexandrou
falexandrou / varnish.php
Created May 7, 2018 14:23
varnish purge
<?php
/**
* Send data to Varnish
*
* @since 2.6.8
*
* @param string $url The URL to purge.
* @return void
*/
function rocket_varnish_http_purge( $url ) {
@falexandrou
falexandrou / keybase.md
Created April 25, 2018 16:55
keybase.md

Keybase proof

I hereby claim:

  • I am falexandrou on github.
  • I am falexandrou (https://keybase.io/falexandrou) on keybase.
  • I have a public key ASCkxsN8ltxAfUxD0WYm3WKADZ7aiVSq2up2MqF4stqKogo

To claim this, I am signing this object:

@falexandrou
falexandrou / gc.php
Last active April 5, 2018 14:19
PHP Force Garbage Collection
<?php
# If you've exceeded the number of inodes on your server,
# you could as well run `php -a` so you get the interactive shell running
# and then copy & paste the following lines into
# Make sure we're using files as a session save handler
ini_set('session.save_handler', 'files');
ini_set("session.save_path", "/var/lib/php/session");
# The probability of performing garbage cleanup is the ratio: