Skip to content

Instantly share code, notes, and snippets.

Avatar

Johannes Müller straight-shoota

View GitHub Profile
@straight-shoota
straight-shoota / http.server.log
Created Apr 10, 2020
HTTP::Server log of running testssl.sh
View http.server.log
E, [2020-04-10T15:38:08.902789000Z #14627] ERROR -- crystal-run-test_ssl_server.tmp:http.server: Error while connecting a new socket -- OpenSSL::SSL::Error: SSL_accept: I/O error
E, [2020-04-10T15:38:09.113485000Z #14627] ERROR -- crystal-run-test_ssl_server.tmp:http.server: Error while connecting a new socket -- OpenSSL::SSL::Error: SSL_accept: error:1408F10B:SSL routines:ssl3_get_record:wrong version number
E, [2020-04-10T15:38:09.323018000Z #14627] ERROR -- crystal-run-test_ssl_server.tmp:http.server: Error while connecting a new socket -- OpenSSL::SSL::Error: SSL_accept: error:1408F10B:SSL routines:ssl3_get_record:wrong version number
E, [2020-04-10T15:38:10.649837000Z #14627] ERROR -- crystal-run-test_ssl_server.tmp:http.server: Error while connecting a new socket -- OpenSSL::SSL::Error: SSL_accept: error:1408F10B:SSL routines:ssl3_get_record:wrong version number
E, [2020-04-10T15:38:10.717875000Z #14627] ERROR -- crystal-run-test_ssl_server.tmp:http.server: Error while connecting a new socket
@straight-shoota
straight-shoota / fix_tls
Created Apr 9, 2020
Crystal SSL Server testssl.sh reports
View fix_tls
No engine or GOST support via engine with your /usr/bin/openssl
###########################################################
testssl.sh 3.1dev from https://testssl.sh/dev/
(c90bd84fe 2020-04-09 13:59:35 -- )
This program is free software. Distribution and
modification under GPLv2 permitted.
USAGE w/o ANY WARRANTY. USE IT AT YOUR OWN RISK!
@straight-shoota
straight-shoota / Makefile
Last active Jun 12, 2020
Makefile for Crystal + Shards
View Makefile
-include Makefile.local # for optional local options
BUILD_TARGET ::= bin/app
# The shards command to use
SHARDS ?= shards
# The crystal command to use
CRYSTAL ?= crystal
SRC_SOURCES ::= $(shell find src -name '*.cr' 2>/dev/null)
View software_version.cr
# The `SoftwareVersion` type represents a version number.
#
# An instance can be created from a version string which consists of a series of
# segments separated by periods. Each segment contains one ore more alpanumerical
# ASCII characters. The first segment is expected to contain only digits.
#
# There may be one instance of a dash (`-`) which denotes the version as a
# pre-release. It is otherwise equivalent to a period.
#
# Optional version metadata may be attached and is separated by a plus character (`+`).
@straight-shoota
straight-shoota / pre-commit
Last active Apr 4, 2019
Git pre-commit hook for `crystal tool format`
View pre-commit
#!/bin/sh
#
# This script ensures Crystal code is correctly formatted before committing it.
# It won't apply any format changes automatically.
#
# Only staged files (the ones to be committed) are being processed, but each file is checked
# entirely as it is stored on disc, even parts that are not staged.
#
# To use this script, it needs to be installed in the local git repository. For example by running
# curl https://gist.githubusercontent.com/straight-shoota/fdaf4cf1954e084cd5abccf8f77975f6/raw/pre-commit > .git/hooks/pre-commit && chmod +x .git/hooks/pre-commit
View Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
clone_crystal_from_vagrant = lambda do |config|
config.vm.provision :shell, privileged: false, inline: %(
# Checkout crystal repository
git clone /vagrant crystal
)
end
View crystal-api.cr
require "json"
module Crystal::Docs
record Program,
project_info : ProjectInfo,
constants : Array(Constant),
types : Array(Type),
methods : Array(Method),
macros : Array(Macro)
@straight-shoota
straight-shoota / reuseport.c
Last active Sep 12, 2018
Test support of SO_REUSEPORT
View reuseport.c
// Simple program to test support of SO_REUSEPORT
// Adapted from https://blog.dubbelboer.com/2016/04/23/so-reuseport.html
#include <stdio.h>
#include <errno.h>
#include <sys/socket.h>
#include <unistd.h>
int main() {
#ifdef SO_REUSEPORT
@straight-shoota
straight-shoota / spindle.cr
Last active Jul 30, 2018
Spindle - Structured Concurrency for Crystal (PoC)
View spindle.cr
def bob
10.times do
puts "B"
sleep 0.006
end
end
def alice
3.times do
puts "A"
@straight-shoota
straight-shoota / empty.ll
Created Apr 22, 2018
[Crystal] LLVM module validation failed: Both operands to a binary operator are not of the same type!
View empty.ll
This file has been truncated, but you can view the full file.
; ModuleID = 'main_module'
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
%String = type { i32, i32, i32, i8 }
%"Slice(UInt8)" = type { i32, i1, i8* }
%"Array(String)" = type { i32, i32, i32, %String** }
%"->" = type { i8*, i8* }
%"Array(Pointer(Void))" = type { i32, i32, i32, i8** }
You can’t perform that action at this time.