Skip to content

Instantly share code, notes, and snippets.

@malte-v
malte-v / logger.cr
Last active November 26, 2018 15:11
Crystal shared library demo
fun init = crystal_init(argc : Int32, argv : UInt8**) : Void
GC.init
LibCrystalMain.__crystal_main(argc, argv)
end
fun log = crystal_log(text: UInt8*): Void
puts String.new(text)
end
@malte-v
malte-v / settings.json
Last active November 18, 2019 12:55
Material-style semantic C++ syntax highlighting for VSCode (cquery)
"cquery.highlighting.enabled.types": true,
"cquery.highlighting.enabled.freeStandingFunctions": true,
"cquery.highlighting.enabled.memberFunctions": true,
"cquery.highlighting.enabled.freeStandingVariables": true,
"cquery.highlighting.enabled.memberVariables": true,
"cquery.highlighting.enabled.namespaces": true,
"cquery.highlighting.enabled.macros": true,
"cquery.highlighting.enabled.enums": true,
"cquery.highlighting.enabled.typeAliases": true,
"cquery.highlighting.enabled.enumConstants": true,
@malte-v
malte-v / recmap.hs
Created May 16, 2020 11:54
Haskell record to map/map to record converter
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TemplateHaskell #-}
module Routing.Duplex.TH where
import Control.Isomorphism.Partial (Iso(..))
import Data.Dynamic (Dynamic, fromDynamic, toDyn)
import Data.List (foldl')
import Data.Map (Map, fromList, lookup)
{-# LANGUAGE TemplateHaskell #-}
module Common.TH
( includeFileInSource,
chooseAndIncludeFileInSource,
)
where
import Control.Monad.Extra (findM)
import Language.Haskell.TH
This file has been truncated, but you can view the full file.
Flat profile:
Each sample counts as 0.01 seconds.
% cumulative self self total
time seconds seconds calls us/call us/call name
40.00 2134.14 2134.14 Kakoune::ForwardChangesTracker::get_new_coord(Kakoune::BufferCoord) const
15.11 2940.08 805.94 auto Kakoune::update_range<std::tuple<Kakoune::InclusiveBufferRange, Kakoune::String>, Kakoune::update_forward<std::vector<std::tuple<Kakoune::InclusiveBufferRange, Kakoune::String>, Kakoune::Allocator<std::tuple<Kakoune::InclusiveBufferRange, Kakoune::String>, (Kakoune::MemoryDomain)5> > >(Kakoune::ArrayView<Kakoune::Buffer::Change const>, std::vector<std::tuple<Kakoune::InclusiveBufferRange, Kakoune::String>, Kakoune::Allocator<std::tuple<Kakoune::InclusiveBufferRange, Kakoune::String>, (Kakoune::MemoryDomain)5> >&)::{lambda(Kakoune::BufferCoord const&)#1}&>(Kakoune::ForwardChangesTracker&, std::vector<std::tuple<Kakoune::InclusiveBufferRange, Kakoune::St
This file has been truncated, but you can view the full file.
Flat profile:
Each sample counts as 0.01 seconds.
% cumulative self self total
time seconds seconds calls s/call s/call name
47.42 1993.37 1993.37 3312481871 0.00 0.00 Kakoune::ForwardChangesTracker::get_new_coord(Kakoune::BufferCoord) const
14.70 2611.28 617.91 3322358635 0.00 0.00 auto Kakoune::update_range<std::tuple<Kakoune::InclusiveBufferRange, Kakoune::String>, Kakoune::update_forward<std::vector<std::tuple<Kakoune::InclusiveBufferRange, Kakoune::String>, Kakoune::Allocator<std::tuple<Kakoune::InclusiveBufferRange, Kakoune::String>, (Kakoune::MemoryDomain)5> > >(Kakoune::ArrayView<Kakoune::Buffer::Change const>, std::vector<std::tuple<Kakoune::InclusiveBufferRange, Kakoune::String>, Kakoune::Allocator<std::tuple<Kakoune::InclusiveBufferRange, Kakoune::String>, (Kakoune::MemoryDomain)5> >&)::{lambda(Kakoune::BufferCoord const&)#1}&>(Kakoune::ForwardChangesTracker&, std::vector<std::tuple<Kakoune::InclusiveBufferRange, Kakoune
diff --git a/libtransmission/announcer-http.c b/libtransmission/announcer-http.c
index 8f99dfce6..34a651b3a 100644
--- a/libtransmission/announcer-http.c
+++ b/libtransmission/announcer-http.c
@@ -109,7 +109,7 @@ static char* announce_url_new(tr_session const* session, tr_announce_request con
announce twice. At any rate, we're already computing our IPv6
address (for the LTEP handshake), so this comes for free. */
- ipv6 = tr_globalIPv6();
+ ipv6 = tr_globalIPv6(session);