Skip to content

Instantly share code, notes, and snippets.

@craSH
craSH / init-tunnels.sh
Last active June 3, 2016 08:17
Script to setup multiple SSH tunnels in a reliable way for use with FoxyProxy or other SOCKS-aware clients
#!/usr/bin/env bash
#
# Use to setup numerous various tunnels to SSH servers, useful with ssh config blocks like those below
# for each host, with incrementing port numbers for each - then configure FoxyProxy etc to use the unique
# port for each host you want to tunnel out of.
#
# Thanks to tecknicaltom <tecknicaltom@neg9.org> for the initial idea behind tying this all together.
#
# Host host_alpha
# IdentityFile ~/.ssh/id_ecdsa-$USER-host_alpha-<remote_hostname>-<key_gen_year>-<key_gen_month>
@yeungeek
yeungeek / multi_accout.md
Last active September 1, 2021 01:34
Git多帐号配置

在使用git,gitlab的时候,会在.ssh目录下生成对应rsa文件,那如果是有多个配置,该怎么处理?

如何生成ssh密钥,可以参考 generating-ssh-keys
##1. 多帐号配置 需要在.ssh目录下,增加config配置,config可以配置多个git的帐号

 #Host myhost(这里是自定义的host简称,以后连接远程服务器就可以用命令ssh myhost)[注意下面有缩进]
     #User 登录用户名(如:git)
     #HostName 主机名可用ip也可以是域名(如:github.com或者bitbucket.org)
     #Port 服务器open-ssh端口(默认:22,默认时一般不写此行
@zhugexiaobo
zhugexiaobo / updateRepo.sh
Created August 29, 2013 10:30
批量 git pull 仓库最新代码
#!/bin/sh
for dir in $(ls -d */)
do
if [ -d "$dir"/.git ]; then
echo "$dir" && cd "$dir" && git pull && cd ..
fi
done
@craSH
craSH / Password.java
Last active June 12, 2024 05:13
A simple example Java class to safely generate and verify bcrypt password hashes for use in authentication systems.
/**
* Author: Ian Gallagher <igallagher@securityinnovation.com>
*
* This code utilizes jBCrypt, which you need installed to use.
* jBCrypt: http://www.mindrot.org/projects/jBCrypt/
*/
public class Password {
// Define the BCrypt workload to use when generating password hashes. 10-31 is a valid value.
private static int workload = 12;