Skip to content

Instantly share code, notes, and snippets.

View ilyabrin's full-sized avatar
Go, JavaScript

Ilya Brin ilyabrin

Go, JavaScript
View GitHub Profile
@ilyabrin
ilyabrin / main.go
Created August 1, 2018 20:30 — forked from enricofoltran/main.go
A simple golang web server with basic logging, tracing, health check, graceful shutdown and zero dependencies
package main
import (
"context"
"flag"
"fmt"
"log"
"net/http"
"os"
"os/signal"
@ilyabrin
ilyabrin / letsencrypt_2016.md
Created April 27, 2017 23:32 — 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 modes when you don't want Certbot to edit your configuration:

  • 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) to renew certificates.

In the following, we're setting up mydomain.com to be served from /var/www/mydomain, and challenges will be served from /var/www/letsencrypt.

@ilyabrin
ilyabrin / digital_ocean_setup.md
Created May 11, 2016 22:25 — forked from ChuckJHardy/digital_ocean_setup.md
DigitalOcean Ubuntu 14.04 x64 + Rails 4 + Nginx + Unicorn + PostgreSQL + Capistrano 3 Setup Instructions

DigitalOcean Ubuntu 14.04 x64 + Rails 4 + Nginx + Unicorn + PostgreSQL + Capistrano 3

SSH into Root

$ ssh root@123.123.123.123

Change Root Password

appTrainers.factory('ModelPhone', ['$http', function ($http) {
function ModelPhone(modelData) {
if (modelData) {
this.setData(modelData);
}
}
ModelPhone.prototype = {
ID_PHONE: '',
FID_CONTACT: '',
@ilyabrin
ilyabrin / task6.rb
Last active August 29, 2015 14:21 — forked from Aduciicba/task6.rb
class Road < Object
attr_accessor :low_bound,
:high_bound,
:transport_count,
:road_id,
:counter
end
file = File.open('F:/input.txt', 'r')
context "HAPPY PATHS" do
#...
scenario "create a parking lot and check hints count" do
@tenant.default_location.parking_lots.first.destroy
click_link "Create Parking Lot"
fill_in "Name", with: "Parking Lot 4"
select "Corporate", from: "Workgroup"
click_button "Submit"
success_messages ["Parking Lot successfully created."]
has_no_error_message
require 'sinatra' # gem install sinatra --no-rdoc --no-ri
set :port, 3000
set :environment, :production
html = <<-EOT
<html><head><style>
#text{width:100%; font-size: 15px; padding: 5px; display: block;}
</style></head><body>
<input id="text" placeholder="Write then press Enter."/>
<div id="chat"></div>
directory = ARGV.shift || Dir.pwd
$dont_get_into = ['.','..']
$allowed = {
'Ruby' => '.rb',
'Ruby HTML Templates' => '.html.erb',
'YAML' => '.yml',
'RDoc' => '.rdoc',
'HTML' => '.html',
'Javascript' => '.js',
'CSS' => '.css',
require 'Twitter' #gem install twitter
while true
begin
# Create a read write application from :
# https://apps.twitter.com
# authenticate it for your account
# fill in the following
config = {
consumer_key: '',
consumer_secret: '',
require 'socket'
require 'base64'
Refresh = 1 # seconds to refresh image on server
screen_capture_command = 'screencapture -C -x tmp.png'
image = ''
latest = Time.now
server = TCPServer.new 3000
loop do