Skip to content

Instantly share code, notes, and snippets.

View merge.sh
#!/bin/bash
BRANCH_CURRENT=$(git rev-parse --abbrev-ref HEAD)
BRANCH_TARGET=
DELETE_CURRENT=0
DEPLOY_COMMAND=
usage() {
echo "Usage: $0 target_branch [options]" 1>&2
echo "Options:" 1>&2
@Wind4
Wind4 / Fibonacci-01.cpp
Created Dec 14, 2015
F(n)=(1/√5)*{[(1+√5)/2]^n - [(1-√5)/2]^n}
View Fibonacci-01.cpp
#include<iostream>
#include<string>
using namespace std;
long Fibonacci(unsigned int n)
{
if(n == 0)
return 0;
else if(n == 1)
return 1;
View sysctl.conf
# Kernel sysctl configuration file for Red Hat Linux
#
# For binary values, 0 is disabled, 1 is enabled. See sysctl(8) and
# sysctl.conf(5) for more details.
# Controls IP packet forwarding
net.ipv4.ip_forward = 0
# Controls source route verification
net.ipv4.conf.default.rp_filter = 1
View gist:27e4a279fc3e0d3647ce
powershell "(Get-WmiObject -query ‘select * from SoftwareLicensingService’).OA3xOriginalProductKey"
View Notepad2.bat
@echo off
SET NP_PATH=%~dp0
SET NP_PATH=%NP_PATH:\=\\%
> ".\OpenWith.reg" ECHO Windows Registry Editor Version 5.00
>>".\OpenWith.reg" ECHO.
>>".\OpenWith.reg" ECHO [HKEY_CLASSES_ROOT\*\shell\np2open]
>>".\OpenWith.reg" ECHO @="Open with Notepad2"
>>".\OpenWith.reg" ECHO.
>>".\OpenWith.reg" ECHO [HKEY_CLASSES_ROOT\*\shell\np2open\command]
View yum
安装yum-utils:
yum install yum-utils开始清理:
清理不被当前系统任何软件所使用的依赖包(应多运行几次):
package-cleanup --leaves
清理当前软件仓库不再支持的孤儿包:
package-cleanup --orphans
清理旧内核:
package-cleanup --oldkernels
更多请man yum-utilsman package-cleanup
也可以利用yum插件删除依赖关系:
View add_swap.sh
fallocate -l 512M /var/swapfile
chmod 0600 /var/swapfile
mkswap /var/swapfile
swapon /var/swapfile
echo "/var/swapfile swap swap sw 0 0" >> /etc/fstab
View pre-commit.cmd
@echo off
setlocal enabledelayedexpansion
:: *******************************************************
:: Get values from action
:: *******************************************************
set REPOS=%1
set TXN=%2
:: *******************************************************
:: If the file doesn't have the correct amount of
@Wind4
Wind4 / ssl.conf
Created Apr 8, 2015
Nginx ssl config
View ssl.conf
# 只支持新的TLS协议,旧的SSLv2、SSLv3协议有漏洞都不应该再使用
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;
# 使用服务器握手密匙,密匙生成用以下命令
# openssl dhparam -out dhparam.pem 4096
# 生成4096位的密匙需要很长时间(数小时),但建议至少2048位
ssl_dhparam /usr/local/nginx/conf/ssl/dhparam.pem;