Skip to content

Instantly share code, notes, and snippets.

@knazarov
knazarov / qemu-cocoa-right-ctrl.diff
Created March 9, 2021 19:53
A qemu cocoa patch to enable right Ctrl (useful when remapping Caps Lock -> Ctrl)
diff --git a/ui/cocoa/view.m b/ui/cocoa/view.m
index a251a737322..1a2fc0e0970 100644
--- a/ui/cocoa/view.m
+++ b/ui/cocoa/view.m
@@ -645,6 +645,13 @@ - (bool) handleEventLocked:(NSEvent *)event
}
return true;
+ case kVK_RightControl:
+ if (!!(modifiers & NSEventModifierFlagControl)) {
@knazarov
knazarov / qemu-edid-5k.diff
Created March 9, 2021 15:02
Qemu patch to allow generating EDID information for 5k resolution
diff --git a/hw/display/edid-generate.c b/hw/display/edid-generate.c
index b0ce583d436..9941fd59aab 100644
--- a/hw/display/edid-generate.c
+++ b/hw/display/edid-generate.c
@@ -129,17 +129,17 @@ static void edid_fill_modes(uint8_t *edid, uint8_t *xtra3, uint8_t *dta,
}
}
-static void edid_checksum(uint8_t *edid)
+static void edid_checksum(uint8_t *edid, size_t len)
@knazarov
knazarov / hvf-x86.diff
Created March 8, 2021 12:33
A patch to make the qemu hvf arm changeset to compile on x86
diff --git a/target/i386/hvf/hvf-accel-ops.c b/target/i386/hvf/hvf-accel-ops.c
deleted file mode 100644
index cbaad238e0d..00000000000
--- a/target/i386/hvf/hvf-accel-ops.c
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- * Copyright 2008 IBM Corporation
- * 2008 Red Hat, Inc.
- * Copyright 2011 Intel Corporation
@knazarov
knazarov / full_text_search_tarantool.lua
Created September 23, 2020 08:00
Full text search example for Tarantool
#!/usr/bin/env tarantool
local pickle = require('pickle')
local yaml = require('yaml')
function trivec(str)
str = string.lower(str)
local vec = ""
#!/usr/bin/env tarantool
-- Sets common rocks paths so that the app can be started from any
-- directory
--
-- By default, when you do require('mymodule'), tarantool looks into
-- the current working directory and whatever is specified in
-- package.path and package.cpath. If you run your app while in the
-- root directory of that app, everything goes fine, but if you try to
-- start your app with "tarantool myapp/init.lua", it will fail to load
-- its modules, and modules from myapp/.rocks.

Keybase proof

I hereby claim:

  • I am knazarov on github.
  • I am knazarov (https://keybase.io/knazarov) on keybase.
  • I have a public key whose fingerprint is F0A7 A0C7 1ACD 8114 3C8A DA61 34C5 361A 7877 0B37

To claim this, I am signing this object:

@knazarov
knazarov / serialize.diff
Created November 29, 2018 10:05
Tarantool output in Lua instead of YAML
diff --git a/src/box/CMakeLists.txt b/src/box/CMakeLists.txt
index d1276472b..2ab48db84 100644
--- a/src/box/CMakeLists.txt
+++ b/src/box/CMakeLists.txt
@@ -12,6 +12,7 @@ lua_source(lua_sources lua/feedback_daemon.lua)
lua_source(lua_sources lua/net_box.lua)
lua_source(lua_sources lua/upgrade.lua)
lua_source(lua_sources lua/console.lua)
+lua_source(lua_sources lua/serialize.lua)
lua_source(lua_sources lua/xlog.lua)
@knazarov
knazarov / serialize.diff
Created November 29, 2018 10:05
Tarantool output in Lua instead of YAML
diff --git a/src/box/CMakeLists.txt b/src/box/CMakeLists.txt
index d1276472b..2ab48db84 100644
--- a/src/box/CMakeLists.txt
+++ b/src/box/CMakeLists.txt
@@ -12,6 +12,7 @@ lua_source(lua_sources lua/feedback_daemon.lua)
lua_source(lua_sources lua/net_box.lua)
lua_source(lua_sources lua/upgrade.lua)
lua_source(lua_sources lua/console.lua)
+lua_source(lua_sources lua/serialize.lua)
lua_source(lua_sources lua/xlog.lua)
@knazarov
knazarov / http_unix_sock.diff
Created January 12, 2018 05:54
A PoC of http+unix:// support in the Tarantool http client
diff --git a/src/httpc.c b/src/httpc.c
index 84ea67aba..cecf30712 100644
--- a/src/httpc.c
+++ b/src/httpc.c
@@ -36,6 +36,33 @@
#include "fiber.h"
+int ishex(int x)
+{
@knazarov
knazarov / proxy_upstream_connclose.diff
Created April 8, 2017 19:53
A patch to close upstream connections on setting the "down" flag
--- ./bundle/nginx-1.11.2/src/stream/ngx_stream_proxy_module.c 2017-04-06 15:55:53.000000000 +0300
+++ ./bundle/nginx-1.11.2/src/stream/ngx_stream_proxy_module.c 2017-04-08 22:50:56.000000000 +0300
@@ -1,4 +1,3 @@
-
/*
* Copyright (C) Roman Arutyunyan
* Copyright (C) Nginx, Inc.
@@ -1152,6 +1151,10 @@
ngx_log_handler_pt handler;
ngx_stream_upstream_t *u;