Skip to content

Instantly share code, notes, and snippets.

@takscape
takscape / tmux.conf
Last active May 31, 2026 01:40
tmux.conf
set -s set-clipboard on
set -g focus-events on
set -sa terminal-features ',xterm-256color:RGB'
set -g mouse on
bind y run-shell "wl-paste -n | tmux load-buffer - && tmux paste-buffer -p && tmux delete-buffer"
bind -n MouseDown2Pane run-shell "wl-paste -n | tmux load-buffer - && tmux paste-buffer -p && tmux delete-buffer"
def gemini [
prompt: string,
--model (-m): string = 'gemini-2.0-flash'
] {
http post --content-type application/json $"https://generativelanguage.googleapis.com/v1beta/models/($model):generateContent?key=($GEMINI_API_KEY)" {
"contents": [
{
"parts": [
{
"text": $prompt
@takscape
takscape / .xonshrc
Created January 27, 2022 14:00
.xonshrc example
# vim: ft=python
def _init():
import os.path as p
$XONSH_ENCODING = "utf-8"
$XONSH_SHOW_TRACEBACK = False
$FORCE_POSIX_PATHS = True
$XONSH_COLOR_STYLE = "monokai"
$XONSH_HISTORY_BACKEND = 'sqlite'
$PROMPT = "{env_name:{} }{BOLD_CYAN}{cwd_base}{branch_color}{curr_branch: {}}{RESET} ${RESET} "
{
"configurations": [
{
"name": "Mac",
"includePath": [
"/usr/include",
"/usr/local/include",
"${workspaceFolder}"
],
"defines": [],
#include <iostream>
#include <sstream>
#include <tuple>
using namespace std;
template <size_t Pos, typename Tpl, typename Head>
void _format_tuple(ostream& os, const Tpl& tpl) {
os << get<Pos>(tpl);
}
package ninja.util.camel.example
import org.apache.camel.CamelContext
import org.apache.camel.Exchange
import org.apache.camel.ProducerTemplate
import org.apache.camel.builder.ExchangeBuilder
import org.apache.camel.builder.RouteBuilder
import org.apache.camel.impl.DefaultCamelContext
fun CamelContext.addRoute(f : RouteBuilder.() -> Unit) {
#lang racket
(require data/heap)
(struct item
(timestamp priority id event)
#:transparent)
; x < yなら#t, x > yなら#fを返す。
; x = yなら、bodyの評価結果を返す。
fn call_f<F>(f: &F) -> i32 where F: ?Sized, F: Fn(i32) -> i32 {
f(100)
}
fn main() {
let f : Box<Fn(i32) -> i32> = Box::new(|&: x| 2 * x);
let v : i32 = call_f(&*f);
println!("{}", v);
}
fn call_f<F: ?Sized + Fn(i32) -> i32>(f: &F) -> i32 {
f(100)
}
fn main() {
let f : Box<Fn(i32) -> i32> = Box::new(|&: x| 2 * x);
let v : i32 = call_f(&*f);
println!("{}", v);
}
use std::num::Int;
use std::iter::{Iterator, iterate};
struct FibIter<'a, T:Int> {
iterator : Box<Iterator<Item=T> + 'a>
}
impl <'a, T:Int> Iterator for FibIter<'a, T> {
type Item = T;