Skip to content

Instantly share code, notes, and snippets.

View MosakujiHokuto's full-sized avatar

Youkou Tenhouin MosakujiHokuto

View GitHub Profile
@MosakujiHokuto
MosakujiHokuto / reuseport_test_udp_mc_client.c
Created December 29, 2020 17:07
SO_REUSEPORT with UDP multicast
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/ip.h>
#include <arpa/inet.h>
@MosakujiHokuto
MosakujiHokuto / .gitignore
Created August 4, 2020 00:08 — forked from zolunx10/.gitignore
Rime用颜文字(及符号)字典. 个人都绑定到v键开头了, 请下载kaomoji*并酌情修改字典文件.dict.yaml; 另如果要在当前输入法中直接嵌入, 请参考luna_pinyin_simp.custom.yaml前半段修改您的输入法设置.
*
!.gitignore
!alternative.yaml
!*.custom.yaml
!kaomoji.*.yaml
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/ip.h>
#include <arpa/inet.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/ip.h>
#include <arpa/inet.h>
diff --git a/unix/zerrors_solaris_amd64.go b/unix/zerrors_solaris_amd64.go
index 46e054c..c5cfa8d 100644
--- a/unix/zerrors_solaris_amd64.go
+++ b/unix/zerrors_solaris_amd64.go
@@ -1,7 +1,7 @@
// mkerrors.sh -m64
// Code generated by the command above; see README.md. DO NOT EDIT.
-// +build amd64,solaris
+// +build amd64,illumos
@MosakujiHokuto
MosakujiHokuto / heap.c
Last active August 29, 2015 14:03
A Simple Memory Allocator
/* DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE */
/* Version 2, December 2004 */
/* Copyright (C) 2012 Chapaev <chapaev@fpscopycatresistance.org> */
/* Everyone is permitted to copy and distribute verbatim or modifiedcopies of this license document, and changing it is allowed as longas the name is changed. */
/* DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION */
/* 0. You just DO WHAT THE F**K YOU WANT TO. */
#include "heap.h"
#include "heap_ifce.h"
@MosakujiHokuto
MosakujiHokuto / create_index.pl
Last active August 29, 2015 14:01
Simple code search
#!/usr/bin/env perl
use strict;
use warnings;
use Redis;
my @files = (<*.c>,<*.h>,<*.cc>,<*.hh>,<*.cpp>,<*.hpp>);
my $redis = Redis->new;
#include "mempool.h"
#include <stdlib.h>
void
mempool_new(struct hmd_mempool *pool)
{
struct hmd_mempool_chunk *chunk;
chunk = malloc(sizeof(struct hmd_mempool_chunk));
chunk->prev = NULL;
@MosakujiHokuto
MosakujiHokuto / http_parser.erl
Created May 2, 2014 10:14
Static File Server in Erlang
-module(http_parser).
-export([run/1,continue/2]).
-define(PATH_RESERVED_CHARS,"!*'();:@&=+$,/?%#[]").
is_ctl(C) ->
(((0 =< C) and (8 >= C))
or ((11 =< C) and (31 >= C))
or (C == 127)).
@MosakujiHokuto
MosakujiHokuto / chatroom.erl
Last active April 28, 2024 23:14
A Simple Telnet Chatroom in Erlang
-module(chatroom).
-export([run/1,worker/2,client_listener/2]).
client_listener(Client,Sock) ->
case gen_tcp:recv(Sock,0) of
{ok,Pack} ->
Client ! {sendmsg,Pack},
client_listener(Client,Sock);
Other ->
Other