Skip to content

Instantly share code, notes, and snippets.

View keevitaja's full-sized avatar
💭
building jedmud

Tanel Tammik keevitaja

💭
building jedmud
View GitHub Profile
<?php
namespace Acty\ClassifiedsModule;
use Acty\ClassifiedsModule\Advert\Form\AdvertFormBuilder;
use Acty\ClassifiedsModule\Advert\Form\PublicAdvertFormBuilder;
use Acty\ClassifiedsModule\Entry\Form\EntryFormBuilder;
use Acty\ClassifiedsModule\Type\Contract\TypeRepositoryInterface;
use Anomaly\Streams\Platform\Addon\Plugin\Plugin;
use Twig_SimpleFunction;
<?php namespace Keevitaja\TestModule;
use Closure;
use Illuminate\Http\Request;
use Illuminate\Translation\Translator;
class LoadTranslations
{
protected $trans;
@keevitaja
keevitaja / dropdown.scss
Last active March 20, 2018 17:48
Bulma nav dropdown
.has-dropdown {
display: relative;
.dropdown {
display: none;
position: absolute;
background-color: $white-bis;
padding: 14px;
border: 1px solid $grey-lighter;
border-radius: $radius;
@keevitaja
keevitaja / checksum.js
Created May 6, 2017 08:05
Cheap hash for javascript
export default (s)=> {
let hash = 0
let strlen = s.length
if ( strlen === 0 ) {
return hash;
}
for (let i = 0; i < strlen; i++) {
let c = s.charCodeAt(i)
const blessed = require('blessed')
const colors = require('colors')
const screen = blessed.screen({
smartCSR: true
})
let index = 0
const display = blessed.box({
const blessed = require('blessed')
const colors = require('colors')
const screen = blessed.screen({
smartCSR: true
})
let index = 0
let page = []
@keevitaja
keevitaja / default.vcl
Created April 30, 2018 05:55 — forked from kamigerami/default.vcl
haproxy + ssl -> varnish -> back to haproxy for loadbalancing to --> backend0/1/2 (webhost)
# This versions uses ELB loadbalancing
# The ELB points to these two HAProxy hosts
# The C-name of the Domain points to the ELB
# ELB -> HAPROXY 1 or 2 -> Varnish --> HIT or MISS --> HAPROXY 1 or 2 -> Backend 1/2/3
vcl 4.0;
import directors;
backend haproxy1 {
.host = "172.31.xx.235"; # back to HAPROXY-1 internal address
.port = "8080";
.probe = {
@keevitaja
keevitaja / nginx.conf
Created May 9, 2018 09:17 — forked from nrollr/nginx.conf
NGINX config for SSL with Let's Encrypt certs
# Advanced config for NGINX
server_tokens off;
add_header X-XSS-Protection "1; mode=block";
add_header X-Content-Type-Options nosniff;
# Redirect all HTTP traffic to HTTPS
server {
listen 80;
server_name www.domain.com domain.com;
return 301 https://$host$request_uri;
@keevitaja
keevitaja / letsencrypt_2017.md
Created May 9, 2018 09:35 — forked from cecilemuller/letsencrypt_2020.md
How to setup Let's Encrypt for Nginx on Ubuntu 16.04 (including IPv6, HTTP/2 and A+ SLL rating)

How to setup Let's Encrypt for Nginx on Ubuntu 16.04 (including IPv6, HTTP/2 and A+ SLL rating)

There are two main modes to run the Let's Encrypt client (called Certbot):

  • Standalone: replaces the webserver to respond to ACME challenges
  • Webroot: needs your webserver to serve challenges from a known folder.

Webroot is better because it doesn't need to replace Nginx (to bind to port 80).

In the following, we're setting up mydomain.com. HTML is served from /var/www/mydomain, and challenges are served from /var/www/letsencrypt.

const { app, component, controllers, system, options } = require('jedmud-component')
component(()=> {
const { alias, short, trigger, block, gag } = controllers
alias.set('^yolo$', ()=> system.send('say yolo'))
short.set('^y$', 'yolo')
short.set('^rl ', '#system reload ')
const id = trigger.set('\{say\}You say', ()=> {