Skip to content

Instantly share code, notes, and snippets.

View thelebster's full-sized avatar
:octocat:
Do nothing, it is ok.

Anton Lebedev thelebster

:octocat:
Do nothing, it is ok.
View GitHub Profile
@thelebster
thelebster / gist:b9a6fb6c9fd60586c077cd9ea1cebbf8
Created August 27, 2018 11:56 — forked from aku/gist:5466527
Example of Socket.io proxy config for NGINX (version 1.3.13+)
upstream backend {
server 127.0.0.1:3000;
}
server {
listen 80;
access_log /var/log/nginx/yoursite.access.log;
error_log /var/log/nginx/yoursite.error.log;
@thelebster
thelebster / docker-ce-ubuntu-17.10.md
Created August 29, 2018 06:19 — forked from raminfp/docker-ce-ubuntu-17.10.md
Install Docker CE on Ubuntu 17.10 and Docker-compose

Installing Docker CE on Ubuntu 17.10 Artful Aardvark

As of 20/10/2017, a release file for Ubuntu 17.10 Artful Aardvark is not available on Download Docker.

sudo apt-get update
sudo apt-get install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo apt-key fingerprint 0EBFCD88
@thelebster
thelebster / gist:d6302f1b4796a44bcd5d770a883e564a
Created August 29, 2018 06:39 — forked from adamstac/gist:7462202
Install and configure Sendmail on Ubuntu

Install and configure Sendmail on Ubuntu

This should help you get Sendmail installed with basic configuration on Ubuntu.

  1. If sendmail isn't installed, install it: sudo apt-get install sendmail
  2. Configure /etc/hosts file: nano /etc/hosts
  3. Make sure the line looks like this: 127.0.0.1 localhost yourhostname
  4. Run Sendmail's config and answer 'Y' to everything: sudo sendmailconfig
  5. Restart apache sudo service apache2 restart
@thelebster
thelebster / gist:f8f3ad580a212c518cf44b682f255f77
Created August 29, 2018 08:15
Remove Sendmail from Ubuntu

Remove Sendmail from Ubuntu

This should help you completely uninstall Sendmail and all that comes with it.

First, stop the service (assuming it's running).

sudo /etc/init.d/sendmail stop

Uninstall sendmail and sendmail-bin

@thelebster
thelebster / chat-frontend.js
Created September 5, 2018 10:02 — forked from martinsik/chat-frontend.js
Node.js chat frontend and server
$(function () {
"use strict";
// for better performance - to avoid searching in DOM
var content = $('#content');
var input = $('#input');
var status = $('#status');
// my color assigned by the server
var myColor = false;
@thelebster
thelebster / README.md
Created September 25, 2018 09:29 — forked from jmolivas/README.md
Render a form on a page via a Controller on Drupal8.

Create file at ~/console/chain/generate-controller-form-render.yml containing:

command:
  name: 'generate:controller:form:render'
  description: 'Controller + Form generator'
commands:
  - command: 'generate:module'
    options:
        module: example
@thelebster
thelebster / lftp mirror
Created November 1, 2018 08:25 — forked from ChrisBuchholz/lftp mirror
script to set up dir mirroring with lftp
## http://serverfault.com/a/106365
##
## As written by esel
##
## lftp is very good tool.
##
## I suggest you to parametrize the script, and make use of the
##
## exclude-glob
## options, that excludes filenames using the glob feature (*,? ..) of your shell:
@thelebster
thelebster / 1-file.txt
Created November 2, 2018 11:05 — forked from cowboy/1-file.txt
Iterate over all lines in a file, handing extra trailing newlines
foo bar
baz
qux
last line (there may or may not be a trailing newline after this line)
@thelebster
thelebster / mongo-distinct-with-count.js
Created November 13, 2018 04:14 — forked from matthieuprat/mongo-distinct-with-count.js
Mongo's distinct with occurrences
/**
* Like Mongo's db.collection.distinct but with counts for each field value.
* See https://docs.mongodb.org/v3.0/reference/method/db.collection.distinct.
*
* Example:
* > distinct('inventory', 'items.sku', { dept: 'A' })
* { "111" : 2, "333" : 1 }
*/
function distinct(collection, field, query) {
var map = {}
@thelebster
thelebster / ajax_example.info.yml
Created November 17, 2018 15:28 — forked from AkshayKalose/ajax_example.info.yml
Drupal 8 - Ajax Example
name: 'Ajax Example'
description: 'Just an Ajax Example'
core: 8.x
type: module