Skip to content

Instantly share code, notes, and snippets.

View suhovius's full-sized avatar
🤘
Metal

Suhovius suhovius

🤘
Metal
View GitHub Profile
@suhovius
suhovius / ws-with-nginx-proxy
Created March 16, 2017 09:42 — forked from namnv609/ws-with-nginx-proxy
ActionCable WebSocket with NginX proxy
server {
listen 80;
listen 443 ssl;
server_name servername.domain;
ssl on;
ssl_certificate /etc/apache2/ssl/apache.crt;
ssl_certificate_key /etc/apache2/ssl/apache.key;
ssl_session_timeout 5m;
ssl_protocols SSLv2 SSLv3 TLSv1;
@suhovius
suhovius / curl-websocket.sh
Created March 14, 2017 21:34 — forked from htp/curl-websocket.sh
Test a WebSocket using curl.
curl --include \
--no-buffer \
--header "Connection: Upgrade" \
--header "Upgrade: websocket" \
--header "Host: example.com:80" \
--header "Origin: http://example.com:80" \
--header "Sec-WebSocket-Key: SGVsbG8sIHdvcmxkIQ==" \
--header "Sec-WebSocket-Version: 13" \
http://example.com:80/
@suhovius
suhovius / blank-html-template
Created March 10, 2017 10:16 — forked from hubgit/blank-html-template
A blank HTML Strict template
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>Title</title>
<link rel="stylesheet" href="style.css"/>
<style></style>
<script src="script.js"></script>
@suhovius
suhovius / examplepayload.json
Created February 7, 2017 16:37 — forked from edwardmp/examplepayload.json
Example APNS payload with ttile
{
"aps":{
"alert":{
"body":"The status of flight KL123 scheduled 20:30 to London Heathrow has changed to 'boarding'. Boarding at 20:05.",
"title":"Boarding at 20:05"
},
"category":"openFlightCategory"
},
}
@suhovius
suhovius / exercise.tour.go
Created January 22, 2017 14:33 — forked from zyxar/exercise.tour.go
tour.golang exercise solutions
/* Exercise: Loops and Functions #43 */
package main
import (
"fmt"
"math"
)
func Sqrt(x float64) float64 {
z := float64(2.)
@suhovius
suhovius / restart coreaudio daemon
Created November 7, 2016 08:43 — forked from felipecsl/restart coreaudio daemon
Restart Mac OS X coreaudio daemon. Useful if you cannot change the audio output device to Airplay.
sudo kill `ps -ax | grep 'coreaudiod' | grep 'sbin' |awk '{print $1}'`
@suhovius
suhovius / angle-between-points.js
Created January 23, 2016 23:18 — forked from conorbuck/angle-between-points.js
JavaScript: Find the angle between two points
var p1 = {
x: 20,
y: 20
};
var p2 = {
x: 40,
y: 40
};
@suhovius
suhovius / site.conf
Last active August 29, 2015 14:15 — forked from paskal/site.conf
# read more at https://terrty.net/2014/ssl-tls-in-nginx/
# latest version on https://gist.github.com/paskal/628882bee1948ef126dd/126e4d1daeb5244aacbbd847c5247c2e293f6adf
# security test score: https://www.ssllabs.com/ssltest/analyze.html?d=terrty.net
# your nginx version might not have all directives included, test this configuration before using in production against your nginx:
# $ nginx -c /etc/nginx/nginx.conf -t
server {
# public key, contains your public key and class 1 certificate, to create:
# (example for startssl)
# $ (cat example.com.pem & wget -O - https://www.startssl.com/certs/class1/sha2/pem/sub.class1.server.sha2.ca.pem) | tee -a /etc/nginx/ssl/domain.pem > /dev/null
@suhovius
suhovius / about.md
Last active August 29, 2015 14:15 — forked from jasonrudolph/about.md
namespace :monit do
desc "Monit unicorn configuration"
task :unicorn_service_tests, roles: :web do
run "mkdir -p #{shared_path}/config"
template "monit_unicorn.rb.erb", "/tmp/monit_unicorn"
run "#{sudo} mv /tmp/monit_unicorn /etc/monit/conf.d/unicorn_#{application}_#{rails_env}.conf"
unicorn_worker_pids.each do |val|
worker_template "monit_unicorn_worker.rb.erb", "/tmp/monit_unicorn_#{application}_#{rails_env}_#{val}_worker", val