This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Result on Mac Mini M2 Pro: | |
# | |
# use_range returns 199999 | |
# use_range_local returns 199999 | |
# use_zip returns 199999 | |
# use_range: 10.198090834077448 | |
# use_range_local: 8.507670041057281 | |
# use_zip: 6.672960666939616 | |
import timeit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// std::bind() cannot bind std::weak_ptr. | |
// This file provides BindWeakPtr() which can bind a method with a std::weak_ptr. | |
// If the object inside weak_ptr is deleted, the function will become a NOP. | |
#include <iostream> | |
#include <functional> | |
#include <memory> | |
template <typename T> | |
class WeakFunction | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
type One int | |
type Ten int | |
type work struct { | |
object interface{} | |
result chan error |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Stop gif animations on escape | |
// @namespace http://github.com/johan/ | |
// @description Implements the "stop gif animations on hitting the escape key" feature that all browsers except Safari and Google Chrome have had since forever. Now also for Google Chrome! | |
// ==/UserScript== | |
document.addEventListener('keydown', freeze_gifs_on_escape, true); | |
function freeze_gifs_on_escape(e) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <string.h> | |
#include <sys/types.h> | |
#include <sys/socket.h> | |
#include <sys/time.h> | |
#include <arpa/inet.h> | |
#include <netinet/tcp.h> | |
#include <unistd.h> | |
#include <stdbool.h> | |
#include <stdlib.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ cat prog.c | |
#include <stdio.h> | |
void func(); | |
void xyz() { | |
printf("main-xyz\n"); | |
} | |
void xyz2() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ LD_LIBRARY_PATH=. ./prog | |
foo | |
foo-xyz | |
bar | |
foo-xyz | |
$ LD_DEBUG=symbols LD_LIBRARY_PATH=. ./prog | |
... | |
foo | |
21169: symbol=xyz; lookup in file=./prog [0] | |
21169: symbol=xyz; lookup in file=./libfoo.so [0] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ LD_DEBUG=libs out/Debug/chrome | |
30970: find library=libpthread.so.0 [0]; searching | |
30970: search path=/home/fcamel/dev/chromium/src/out/Debug/./tls/x86_64:/home/fcamel/dev/chromium/src/out/Debug/./tls:/home/fcamel/dev/chromium/src/out/Debug/./x86_64:/home/fcamel/dev/chromium/src/out/Debug/. (RPATH from file out/Debug/chrome) | |
30970: trying file=/home/fcamel/dev/chromium/src/out/Debug/./tls/x86_64/libpthread.so.0 | |
30970: trying file=/home/fcamel/dev/chromium/src/out/Debug/./tls/libpthread.so.0 | |
30970: trying file=/home/fcamel/dev/chromium/src/out/Debug/./x86_64/libpthread.so.0 | |
30970: trying file=/home/fcamel/dev/chromium/src/out/Debug/./libpthread.so.0 | |
30970: search cache=/etc/ld.so.cache | |
30970: trying file=/lib/x86_64-linux-gnu/libpthread.so.0 | |
30970: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ ldd /bin/ls | |
linux-vdso.so.1 => (0x00007ffe7a5fe000) | |
libselinux.so.1 => /lib/x86_64-linux-gnu/libselinux.so.1 (0x00007fd64b7a1000) | |
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fd64b3d7000) | |
libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007fd64b167000) | |
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fd64af63000) | |
/lib64/ld-linux-x86-64.so.2 (0x00007fd64b9c3000) | |
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fd64ad46000) |
NewerOlder