Skip to content

Instantly share code, notes, and snippets.

View straight-shoota's full-sized avatar

Johannes Müller straight-shoota

View GitHub Profile
[
{
"author": "HertzDevil",
"state": "APPROVED",
"pr": "PR_kwDOAGkZhc5QGNG7"
},{
"author": "HertzDevil",
"state": "APPROVED",
"pr": "PR_kwDOAGkZhc5QGL6i"
},{
@straight-shoota
straight-shoota / regession-io.no-debug.ll.diff
Last active January 20, 2023 11:16
[Regression] Dwarf loader breaks socket IO in Crystal 1.7 (LLVM IR diff)
This file has been truncated, but you can view the full file.
diff --git 1/regression-io.no-debug.bad.ll 2/regression-io.no-debug.good.ll
index 6e89ec43b..6d5084431 100644
--- 1/regression-io.no-debug.bad.ll
+++ 2/regression-io.no-debug.good.ll
@@ -123,16 +123,14 @@ target triple = "x86_64-unknown-linux-gnu"
%"struct.LibC::Addrinfo" = type { i32, i32, i32, i32, i32, %"struct.LibC::Sockaddr"*, i8*, %"struct.LibC::Addrinfo"* }
%"struct.LibC::Sockaddr" = type { i16, [14 x i8] }
%"struct.LibC::StackT" = type { i8*, i32, i64 }
+%"Char::Reader" = type { %String*, i32, i32, i32, %"(UInt8 | Nil)", i1 }
+%"(UInt8 | Nil)" = type { i32, [1 x i64] }
@straight-shoota
straight-shoota / README.md
Created February 29, 2016 23:53
Unlink unused config files in sites-enabled with Ansible

This task cleans sites-enabled dir from config files that should not be enabled anymore Its quite easy to use a list of enabled sites to link their config files to sites-enabled, as shown in the last entry. There will still be links to the config files of sites that had been enabled in the previous ansible run, they need to be removed explicitly. The simple way would be to remove the sites-enablied directory alltogether. But this would allways require to create new links to the config files for enabled sites. Thus it would force a server restart even if there had really no changes at all. Defining a var disabled_sites is not quite a good idea since you would probably forget to add or remove items from that list at one time. So my solution is to list all config files that do not correspond to enabled sites and in a second step remove those.

I use it with nginx, but it should also work with apache/httpd or other configurations with a similar concept.

It would be easier to use just rm with an extended gl

@straight-shoota
straight-shoota / id_ed25519.pub
Last active October 13, 2022 16:22
SSH keys
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOZzoh/ZzxqO6+SVFlTrdVqkrq842RvfV6UonV7sdAZ5 Johannes@Milos
@straight-shoota
straight-shoota / console.md
Created July 2, 2022 13:15
Crystal comparison Windows vs Linux (with `samples/havlak.cr`)

Comparing compile time and run time performance of Crystal on Windows and Linux. The sample program is https://github.com/crystal-lang/crystal/blob/b7f3f102fd68fcf9fe4f074513c9e374ec98b492/samples/havlak.cr

Both binaries are built and executed on the same system via WSL (this might cause a little bias, but WSL2 performance is very comparative between Windows and Linux). Hardware is a XPS 9710 with i7 11800H.

;TLDR: Compiler performance is very similar, except for LLVM codegen where Windows has the edge (this is probably due to the newer LLVM version). Runtime performance

@straight-shoota
straight-shoota / reuseport.c
Last active June 21, 2022 11:57
Test support of SO_REUSEPORT
// 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 / error-trace.txt
Created January 21, 2022 13:22
Crystal compiler error `--error-trace`
Using /home/linuxbrew/.linuxbrew/bin/llvm-config [version= 13.0.0]
In src/compiler/crystal/program.cr:45:69
 45 | getter splat_expansions : Hash(Def, Type) = ({} of Def => Type).compare_by_identity
^------------------
Error: instantiating 'Hash(Crystal::Def, Crystal::Type)#compare_by_identity()'
In src/hash.cr:976:5
@straight-shoota
straight-shoota / S3 config api
Last active December 14, 2021 22:45
Crystal S3 Config
{
"IndexDocument": {
"Suffix": "index.html"
},
"ErrorDocument": {
"Key": "api/1.2.2/404.html"
},
"RoutingRules": [
{
"Condition": {
@straight-shoota
straight-shoota / diff.diff
Last active August 31, 2021 20:52
Crystal i for linux
diff --git c/src/compiler/crystal/repl/context.cr w/src/compiler/crystal/repl/context.cr
index 1cceb2c45..3451a87d0 100644
--- c/src/compiler/crystal/repl/context.cr
+++ w/src/compiler/crystal/repl/context.cr
@@ -471,8 +472,14 @@ class Crystal::Repl::Context
return unless path && name
- # TODO: obviously support other platforms than darwin
- lib_path = File.join(path, "lib#{name}.dylib")

Keybase proof

I hereby claim:

  • I am straight-shoota on github.
  • I am straightshoota (https://keybase.io/straightshoota) on keybase.
  • I have a public key ASAGiaf3Yvn1msqOmBzwkgy5gS0QDS3qsi_tIeZjYmpc6Ao

To claim this, I am signing this object: