Skip to content

Instantly share code, notes, and snippets.

View wkoszek's full-sized avatar
🎯
Focusing

Adam W. Koszek wkoszek

🎯
Focusing
View GitHub Profile
@cecilemuller
cecilemuller / letsencrypt_2020.md
Last active April 15, 2024 02:19
How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SSL rating)

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


Virtual hosts

Let's say you want to host domains first.com and second.com.

Create folders for their files:

@pahud
pahud / check_spot_price_now.md
Created August 10, 2016 08:10
check current spot price with aws-cli
$ aws --region=ap-northeast-2 ec2 describe-spot-price-history --instance-types c4.large --start-time=$(date +%s) --product-descriptions="Linux/UNIX" --query 'SpotPriceHistory[*].{az:AvailabilityZone, price:SpotPrice}'
[
    {
        "price": "0.024900", 
        "az": "ap-northeast-2a"
    }, 
 {
@gwillem
gwillem / ansible-bootstrap-ubuntu-16.04.yml
Created June 16, 2016 21:59
Get Ansible to work on bare Ubuntu 16.04 without python 2.7
# Add this snippet to the top of your playbook.
# It will install python2 if missing (but checks first so no expensive repeated apt updates)
# gwillem@gmail.com
- hosts: all
gather_facts: False
tasks:
- name: install python 2
raw: test -e /usr/bin/python || (apt -y update && apt install -y python-minimal)
@floriankugler
floriankugler / gist:6870499
Last active September 29, 2023 15:56
Mapping of NSURLConnection to NSURLSession delegate methods. Created by Mattt Thompson.
NSURLConnection | NSURLSession
------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------
NSURLConnectionDelegate connectionShouldUseCredentialStorage: |
------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------
NSURLConnectionDelegate connection:willSendRequestForAuthenticationChallenge: | NSURLSessionDelegate URLSession:didReceiveChallenge:completionHandler:
| N
@hvasconcelos
hvasconcelos / gen_keys.sh
Last active September 19, 2023 23:14
Create an Sinatra SSL Server
# Generate a self-signed Certificate and a Private Key
openssl req -x509 -nodes -days 365 -newkey rsa:1024 -keyout pkey.pem -out cert.crt
@josephspurrier
josephspurrier / sshclient.go
Last active September 10, 2022 02:23
Golang SSH Client
package main
import (
"bufio"
"io/ioutil"
"os/signal"
//"syscall"
"fmt"
"log"
"os"
@mattn
mattn / sinachiku.rb
Created May 8, 2012 06:06
sinatra on mruby
require 'HTTP'
require 'UV'
module Sinachiku
@routes = { 'GET' => [], 'POST' => [] }
def self.route(method, path, opts, &block)
@routes[method] << [path, opts, block]
end
def self.do(r)
@routes[r.method].each {|path|
@mlafeldt
mlafeldt / create-release.rb
Last active March 13, 2017 01:45
Accessing GitHub Releases API with Ruby -- http://developer.github.com/v3/repos/releases/
require "net/https"
require "json"
gh_token = ENV.fetch("GITHUB_TOKEN")
gh_user = ARGV.fetch(0)
gh_repo = ARGV.fetch(1)
release_name = ARGV.fetch(2)
release_desc = ARGV[3]
uri = URI("https://api.github.com")