Skip to content

Instantly share code, notes, and snippets.

@qnighy
qnighy / rust-patterns.md
Last active March 6, 2025 19:03
Rustのパターンっぽいやつメモ

パターンとはその言語が抽象化できなかった敗北の歴史である。 しかしどんなに優れた言語であってもあらゆる繰り返しに勝てるわけではない。 人は必ずメタ繰り返しを欲するからだ。 そしてそれはRustも例外ではない。

ここでは、OOPでも知られているパターンよりも、Rustに特有のパターンを思いつく限りまとめてみた。名前は適当。

  • crate splitting
    • でかいcrateを分割して、見通しを良くする・再コンパイルの分量を削減する・並列コンパイルを可能にする
  • 親玉crate(全てにdependする)と殿crate(全てにdependされる)があることが多いので、だいたい束みたいな形になる。
map $time_iso8601 $upstream {
default "app-b.example.org";
"~T(0|1[01])" "app-a.example.org";
}
server {
server_name app.example.org;
location / {
proxy_pass http://127.0.0.1;
proxy_set_header Host $upstream;
@matsuu
matsuu / nginx.conf
Last active August 29, 2015 14:25
時間帯によってupstreamを変える
map $time_iso8601 $upstream {
default "app-b.example.net";
"~T(0|1[01])" "app-a.example.net";
}
server {
listen 80;
server_name _;
location / {
#!/usr/bin/env jjs
/*####################################################################################################################################
# As Nashorn does not have http capabilities through XMLHttpRequest (DOM API), we have to use regular Java classes instead.
# This sample shows how this can be acheived without depending on any third party libraries. Just a standard Java 8 JDK.
# Make sure to have JAVA_HOME/bin on your PATH for the shebang to work. Then just chmod +x away and run...
# Alternatively if you're on a non *nix OS, start with jjs -scritping httpsample.js
####################################################################################################################################*/
var url = "https://api.github.com/users/billybong/repos";
var response;
@ymmt2005
ymmt2005 / ipv6_linklocal.cpp
Created August 12, 2014 08:52
IPv6 link local address resolution
#include <arpa/inet.h>
#include <ifaddrs.h>
#include <iostream>
#include <netdb.h>
#include <sys/socket.h>
#include <sys/types.h>
int main() {
struct ifaddrs* addr;
getifaddrs(&addr);
### Keybase proof
I hereby claim:
* I am knok on github.
* I am knok (https://keybase.io/knok) on keybase.
* I have a public key whose fingerprint is 9945 2B4D D28B EEAC 8AB5 C931 B066 62EC 9C0C 1404
To claim this, I am signing this object:
@mkouhei
mkouhei / retrieve_jdk.py
Last active August 29, 2015 13:59
retrieving JDK
# -*- coding: utf-8 -*-
"""
Copyright (C) 2014 Kouhei Maeda <[email protected]>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
@diyan
diyan / python_stack.md
Last active September 3, 2020 10:32
Tools and libraries which I prefer to use in Python stack

Tools and libraries which I prefer to use in Python stack

Development Environment

  • Ubuntu Linux for both development and production
  • Git version control system
  • Jenkins CI build server (but recently I'm moving to git server-side hooks with ssh from git server to dev/stage/prod servers)
  • Redmine bug tracking system
  • JetBrains PyCharm IDE

Production Environment

@voluntas
voluntas / mqtt.rst
Last active February 16, 2018 00:03
MQTT コトハジメ

MQTT コトハジメ

更新:2014-05-14
バージョン:0.0.12
作者:@voluntas
URL:http://voluntas.github.io/

とても詳しいまとめがありますので、ますはそちらを見ることをオススメします。