Skip to content

Instantly share code, notes, and snippets.

View takehaya's full-sized avatar
🏠
Working from home

Takeru Hayasaka takehaya

🏠
Working from home
  • BBSakura Networks, Inc.
  • Kyoto Japan
  • 05:28 (UTC +09:00)
View GitHub Profile
@guillaumerose
guillaumerose / netfilter-queue
Created April 7, 2011 09:00
Working with netfilter and libnetfilter-queue
TP 3: Working with netfilter and libnetfilter-queue
The objective of this TP is to work with netfilter kernel module creation and user-space processing of queued packets using libnetfilter-queue.
Important: The result of this TP should be sent to: me@bachwehbi.net or anis.laouiti@it-sudparis.eu with TP3-yourname as a subject.
If you don't finish on time, consider it as a homework and send it before Friday April 15 at 8:00PM.
Context:
--------
Whenever the host receives an incomming ssh connection (on port 22), the module drops the packet.

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@santiagobasulto
santiagobasulto / gist:3056999
Created July 5, 2012 23:05
Mocking private methods in python
""" This is a simple gist to show how to mock
private methods. I've got lots of questions
regarding this topic. Most people seems confused.
Hope it helps.
"""
import unittest
import mock
@rosylilly
rosylilly / gist:3401612
Created August 20, 2012 06:40
先輩と覚える HTTP ステータスコード

先輩に学ぶ HTTP Status Code

超雑にまとめました。修正してください。

登場人物

  • アプリケーション先輩: いつも忙しい。横に広がるのが得意(デブじゃない)。
  • 後輩: 頼んでばっかしで役に立たない。
  • サーバー先輩: アプリケーション先輩と仲がいい。Unix Socket でつながるくらい仲良し。
  • プロクシ先輩: アプリケーション先輩とかサーバー先輩と後輩の間を取り持って代わりに伝えたりしてくれる。たまに勝手にレスポンスを書き換える。
@k0kubun
k0kubun / titech_portal_auto_login.user.js
Last active May 16, 2018 19:44 — forked from gifnksm/titech_portal_auto_login.user.js
東工大ポータルに自動ログインするFirefox用greasemonkeyスクリプトのE4X無効化対応版
// ==UserScript==
// @name Titech Portal Auto Login
// @namespace http://www.titech.ac.jp/
// @id titech-portal-auto-login@www.titech.ac.jp
// @description 東工大ポータルに自動的にログインします
// @author NAKASHIMA, Makoto <makoto.nksm@gmail.com>
// @include https://portal1.nap.gsic.titech.ac.jp/*
// @include https://portal.nap.gsic.titech.ac.jp/*
// @include http://portal.titech.ac.jp/*
// @jsversion 1.8
@kaishuu0123
kaishuu0123 / xv6.md
Last active April 23, 2022 15:56
xv6 を読む

go 1.1 scheduler

where

src/pkg/runtime proc.c asm_*.s

design

@jmblog
jmblog / gist:6077993
Last active November 22, 2021 08:37
所得税と住民税の計算方法

所得税(国税)

所得税の計算方法

所得税額 = (所得金額(A) - 所得控除額(B)) × 税率 - 税額控除額(C)

  • 「所得金額(A)- 所得控除額(B)」は 課税所得金額 といい、1,000円未満の端数を切り捨てる。

所得税の税率

@gfx
gfx / foo.pl
Last active September 17, 2017 21:57
正規表現リテラルがあると便利な例。これを文字列操作メソッドで解決するとなるとかなり難しいと思われますがどうでしょう。 また、正規表現リテラルがなくてもじっさいにはあまり変わりないのですが、 \S ではなく \\S と書かなければならなかったりして注意しなければならない点が増えます。
#!perl
use 5.10.0;
use strict;
use warnings;
my $localhost = join '|', map { quotemeta } 'localhost', '127.0.0.1';
my $s = "http://localhost/foo http://127.0.0.1/bar http://127_0_0_1/foo/bar/baz";
my @matched = $s =~ m{ http:// (?:$localhost) / \S+ }xg;
/**
* Hindley-Milner type inference
* Ported to Groovy from Scala by Example Chapter 16 code.
* (http://www.scala-lang.org/docu/files/ScalaByExample.pdf)
* refered also
* https://github.com/namin/spots/blob/master/hindleyMilner/typeInference.scala
* Japanese page of 'Scala by Example':
* http://www29.atwiki.jp/tmiya/pages/78.html
*/
import groovy.transform.*