Skip to content

Instantly share code, notes, and snippets.

#!/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 December 14, 2015 02:20
F(n)=(1/√5)*{[(1+√5)/2]^n - [(1-√5)/2]^n}
#include<iostream>
#include<string>
using namespace std;
long Fibonacci(unsigned int n)
{
if(n == 0)
return 0;
else if(n == 1)
return 1;
# 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
@Wind4
Wind4 / gist:27e4a279fc3e0d3647ce
Created July 29, 2015 07:34
Windows OEM Key
powershell "(Get-WmiObject -query ‘select * from SoftwareLicensingService’).OA3xOriginalProductKey"
@Wind4
Wind4 / Notepad2.bat
Last active October 19, 2024 07:36
Notepad2
@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]
安装yum-utils:
yum install yum-utils开始清理:
清理不被当前系统任何软件所使用的依赖包(应多运行几次):
package-cleanup --leaves
清理当前软件仓库不再支持的孤儿包:
package-cleanup --orphans
清理旧内核:
package-cleanup --oldkernels
更多请man yum-utilsman package-cleanup
也可以利用yum插件删除依赖关系:
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
@Wind4
Wind4 / pre-commit.cmd
Created April 15, 2015 08:19
SVNHooks
@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 April 8, 2015 04:56
Nginx ssl config
# 只支持新的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;