Skip to content

Instantly share code, notes, and snippets.

Avatar

Wojciech Adam Koszek wkoszek

View GitHub Profile
@pahud
pahud / check_spot_price_now.md
Created Aug 10, 2016
check current spot price with aws-cli
View check_spot_price_now.md
$ 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 Jun 16, 2016
Get Ansible to work on bare Ubuntu 16.04 without python 2.7
View ansible-bootstrap-ubuntu-16.04.yml
# 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)
@cecilemuller
cecilemuller / letsencrypt_2020.md
Last active Oct 21, 2020
How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SSL rating)
View letsencrypt_2020.md

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:

@josephspurrier
josephspurrier / sshclient.go
Last active Sep 29, 2020
Golang SSH Client
View sshclient.go
package main
import (
"bufio"
"io/ioutil"
"os/signal"
//"syscall"
"fmt"
"log"
"os"
@hvasconcelos
hvasconcelos / gen_keys.sh
Last active Nov 28, 2019
Create an Sinatra SSL Server
View gen_keys.sh
# Generate a self-signed Certificate and a Private Key
openssl req -x509 -nodes -days 365 -newkey rsa:1024 -keyout pkey.pem -out cert.crt
@floriankugler
floriankugler / gist:6870499
Last active Jan 27, 2020
Mapping of NSURLConnection to NSURLSession delegate methods. Created by Mattt Thompson.
View gist:6870499
NSURLConnection | NSURLSession
------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------
NSURLConnectionDelegate connectionShouldUseCredentialStorage: |
------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------
NSURLConnectionDelegate connection:willSendRequestForAuthenticationChallenge: | NSURLSessionDelegate URLSession:didReceiveChallenge:completionHandler:
| N
View create-release.rb
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")
@mattn
mattn / sinachiku.rb
Created May 8, 2012
sinatra on mruby
View sinachiku.rb
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|
You can’t perform that action at this time.