This file contains hidden or 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
| // SPDX-License-Identifier: CC0-1.0+ | |
| #include <sys/syscall.h> | |
| #include <sys/user.h> | |
| #include <errno.h> | |
| #include <sys/procfs.h> | |
| #include <sys/wait.h> | |
| #include <stdbool.h> | |
| #include <stdlib.h> | |
| #include <sys/ptrace.h> | |
| #include <string.h> |
This file contains hidden or 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
| class SourceMapConsumer { | |
| private readonly base64Table: string = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; | |
| private readonly mappingItems: MappingItem[]; | |
| constructor(raw: string) { | |
| this.mappingItems = this.parseSourcemap(raw); | |
| } | |
| originalPositionFor(position: Position): MappingItem | null { | |
| for (const item of this.mappingItems) { |
This file contains hidden or 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
| import java.util.concurrent.LinkedBlockingQueue; | |
| import java.util.concurrent.ThreadPoolExecutor; | |
| import java.util.concurrent.TimeUnit; | |
| public class LoopExecutorService { | |
| private int nThreads; | |
| private TaskFactory factory; | |
| private LoopExecutor executor; |
This file contains hidden or 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
| user nobody; | |
| worker_processes 2; | |
| #error_log /dev/null crit; | |
| events { | |
| worker_connections 1024; | |
| } | |
This file contains hidden or 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
| kill -USR2 [old master process] | |
| kill -WINCH [old master process] | |
| # After all old workers quit, shut down the old master process if it is unused any more. | |
| kill -TERM [old master process] | |
| # Revert to the old nginx while the old master was not shutted down. | |
| kill -HUP [old master process] | |
| kill -QUIT [new master process] | |
| kill -TERM [new master process] |
This file contains hidden or 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
| reverse_bytes_in_binary(<<X/binary>>) -> | |
| reverse_bytes(X, <<>>). | |
| reverse_bytes(<<Byte:8, R/binary>>, T) -> | |
| reverse_bytes(R, <<Byte, T/binary>>); | |
| reverse_bytes(<<>>, T) -> | |
| T. |
This file contains hidden or 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
| reverse_bits_in_binary(<<X/binary>>) -> | |
| reverse_bits(X, <<>>). | |
| reverse_bits(<<B1:1, B2:1, B3:1, B4:1, B5:1, B6:1, B7:1, B8:1, R/binary>>, T) -> | |
| reverse_bits(R, <<B8:1, B7:1, B6:1, B5:1, B4:1, B3:1, B2:1, B1:1, T/binary>>); | |
| reverse_bits(<<>>, T) -> | |
| T. |
This file contains hidden or 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
| start(AnAtom, Fun) when is_atom(AnAtom), is_function(Fun, 0) -> | |
| Sender = self(), | |
| Run = fun() -> | |
| case catch register(AnAtom, self()) of | |
| true -> | |
| Sender ! {started, self()}, | |
| Fun(); | |
| _ -> | |
| Sender ! {already_running, self()} | |
| end |