• SecureCRT 中使用 Solarized 配色方案的方法

    16-03-16 17:19 25246 0 未分类

    先修改一些默认设置:

    Options -> Global ptions -> General -> Default Session -> Edit Default Settings…

    打开linux配色方案:

    Terminal -> Emulation 中Terminal选择ANSI or linux or xterm,必须钩上 ANSI Colour

    启用常用的快捷键设置:

    Terminal -> Emulation中Select an alternate keyboard emulation中选择linux

    退出主机自动关闭窗口:

    Terminal -> Close on disconnect Close 打勾

    屏幕显示最大行数:

    Terminal => Emulation => Scrollback 修改为10000。

    使用使用Windows下的拷贝粘贴快捷键,不习惯的话不要启用:

    Terminal => Mapped keys => Use windows copy and paste hotkeys

    字体编码设置:

    Terminal->appearance: 字体选择lucida consolas 12pt, 编码选择utf-8

    1:(0,43,53)    (128,128,0)    (0,160,0)    (160,160,0)    (255,128,128)    (160,0,160)    (0,160,160)    (131,148,150)
    
    2:(128,128,128)    (255,34,65)    (55,187,55)    (255,246,145)    (85,153,153)    (255,0,255)    (103,208,193)    (131,148,150)
    
  • Git 配置全局忽略文件

    16-02-26 15:02 26284 0 未分类

    创建 ~/.gitignore 文件,把需要全局忽略的文件类型塞到这个文件里。

    # .gitignore_global
    ####################################
    ######## OS generated files ########
    ####################################
    .DS_Store
    .DS_Store?
    *.swp
    ._*
    .Spotlight-V100
    .Trashes
    Icon?
    ehthumbs.db
    Thumbs.db
    ####################################
    ############# packages #############
    ####################################
    *.7z
    *.dmg
    *.gz
    *.iso
    *.jar
    *.rar
    *.tar
    *.zip
    

    ~/.gitconfig 中引入刚创建的 .gitignore

    git config --global core.excludesfile ~/.gitignore
    
  • 这次出差到厦门,顺便去了趟鼓浪屿

    15-12-08 09:23 22953 0 生活
    1_thumb.jpg
    6_thumb.jpg
    8_thumb.jpg
    2_thumb.jpg
    3_thumb.jpg
    4_thumb.jpg
    5_thumb.jpg
    7_thumb.jpg
    9_thumb.jpg
  • CentOS 7 搭建 IPSec/IKEv2 VPN 服务器

    15-10-08 09:25 27310 0 技术

    GitHub 地址

    https://github.com/jiangxi14520/one-key-ikev2-vpn

    wget --no-check-certificate https://raw.githubusercontent.com/quericy/one-key-ikev2-vpn/master/one-key-ikev2.sh
    
    chmod +x one-key-ikev2.sh
    bash one-key-ikev2.sh
    

    如果使用 firewalld

    vim /etc/firewalld/zones/public.xml
    

    执行以下命令

    firewall-cmd --zone=dmz --permanent --add-rich-rule='rule protocol value="esp" accept' # ESP (the encrypted data packets)
    firewall-cmd --zone=dmz --permanent --add-rich-rule='rule protocol value="ah" accept' # AH (authenticated headers)
    firewall-cmd --zone=dmz --permanent --add-port=500/udp #IKE  (security associations)
    firewall-cmd --zone=dmz --permanent --add-port=4500/udp # IKE NAT Traversal (IPsec between natted devices)
    firewall-cmd --permanent --add-service="ipsec"
    firewall-cmd --zone=dmz --permanent --add-masquerade
    firewall-cmd --permanent --set-default-zone=dmz
    firewall-cmd --reload
    firewall-cmd --list-all
    
    vim /etc/sysctl.conf
    

    添加以下内容:

    # VPN
    net.ipv4.ip_forward = 1
    net.ipv4.conf.all.accept_redirects = 0
    net.ipv4.conf.all.send_redirects = 0
    

    使之生效:

    sysctl -p
    
    <?xml version="1.0" encoding="utf-8"?>
    <zone>
      <short>Public</short>
      <description>For use in public areas. You do not trust the other computers on networks to not harm your computer. Only selected incoming connections are accepted.</description>
      <service name="dhcpv6-client"/>
      <service name="ssh"/>
      <port protocol="tcp" port="80"/>
      <port protocol="udp" port="500"/>
      <port protocol="tcp" port="500"/>
      <port protocol="udp" port="4500"/>
      <port protocol="udp" port="1701"/>
      <port protocol="tcp" port="1723"/>
      <masquerade/>
    </zone>
    

    Mac 上配置

    进入钥匙串管理,选择登录,然后将证书拖进去。

    不被信任解决方法,右键->属性,选择总是被信任

  • iTerm2 安装 oh-my-zsh 和 power-line

    15-09-10 20:50 21174 0 技术
    pip install powerline-status --user -U
    

    隐藏用户名和主机名 加到

    ZSH_THEME="agnoster"
    DEFAULT_USER="$USER"
    
  • Windows 安装 cygwin64

    15-08-17 12:03 45420 0 未分类

    由于公司给配备了 Windows 7 的开发环境,不得已放弃了 iTerm2,但是 Windows 上实在找不到和 iTerm2 相媲美的命令行工具。 最终选择了 cygwin64,这里讲一下在 cygwin 上安装 oh-my-zsh, tmux 以及 powerline 的方法和步骤。

  • 工作出差到长沙 - 湖南卫视

    15-06-27 22:20 22918 0 生活

    changsha_thumb.jpg

  • HTTP 协议常见错误代码

    15-04-02 10:20 25058 0 技术
  • 入职新浪微博第一天

    15-01-20 20:10 26654 0 生活

    weibo_thumb.jpg

  • 乐观锁和悲观锁

    14-10-06 11:34 24378 0 技术

    乐观锁和悲观锁是两种并发控制策略,用于解决多线程或多进程访问同一资源时的数据一致性问题。

    乐观锁

    • 概念:假设数据很少被修改,因此不会在数据访问前加锁。
    • 机制:读取数据时不加锁,更新时检查数据是否被修改(通常通过版本号或时间戳)。如果数据没有变化,则提交修改;否则,操作失败,需要重试。
    • 适用场景:适合读多写少的场景,避免因频繁加锁导致的性能问题。

    悲观锁

    • 概念:假设数据会被频繁修改,因此在访问前加锁。
    • 机制:读取或修改数据时加锁,确保同一时间只有一个事务可以操作数据。其他尝试获取锁的事务会被阻塞,直到锁被释放。
    • 适用场景:适合写多读少的场景,需要严格控制数据一致性。

    例子

    • 乐观锁:电商网站的库存管理系统,用户读取商品信息时不加锁,提交订单时检查库存是否改变。
    • 悲观锁:银行转账系统,在进行账户余额更新时加锁,以确保数据一致性。

    选择使用哪种锁策略取决于系统的读写比例和对并发的要求。

文章归档

文章日历

2025 年 05 月
28 29 30 31 01 02 03
04 05 06 07 08 09 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31

文章标签

最新评论

友情链接