Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
HOST=$(hostname)
function install_postfix() {
echo | sudo debconf-set-selections <<__EOF
postfix postfix/root_address string
postfix postfix/rfc1035_violation boolean false
postfix postfix/mydomain_warning boolean
postfix postfix/mynetworks string 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
@hydra1983
hydra1983 / download_duokan_files.rb
Last active August 29, 2015 13:56
从多看阅读的 **wifi 传书** 中下载上传的文件
# encoding: utf-8
# ----------------------------------------
# 最终的解决方案是利用这个脚本生成的URL,
# 通过迅雷下载所有的文件
# ----------------------------------------
Encoding.default_internal = Encoding::UTF_8
Encoding.default_external = Encoding::UTF_8
@hydra1983
hydra1983 / hexo_deploy.sh
Created February 28, 2014 02:27
Script to deploy blog generated by Hexo and source to same repository
#!/bin/bash
hexo clean
rm -rf .deploy
hexo deploy
git add -A .
git commit -m "Update sources"
git push
# git_svn_repo should be a clean svn repository
git_svn_repo=<path>
git_repo=<path>
git_remote_repo=<url>
git_user_email=<email>
git_user_name=<name>

cd $git_svn_repo
@hydra1983
hydra1983 / git_svn_merge.md
Last active August 29, 2015 14:03
Merge changes from git to svn
# Fetch all commits
git fetch upstream master

# Find the commit id of last merge
git log

# Generate patches per commit
git format-patch -o <patches dir> <last merge commit id>
SVN_REPO_PATH=/opt/subversion/data/repositories
SVN_REPO_DESC=Subversion Repositories
SVN_REPO_PATH=/svn
SVN_REPO_INDEXED=true
SVN_DEFAULT_USERNAME=svn
SVN_DEFAULT_PASSWORD=svn

svn_list_parent_path=$( [[ "$SVN_REPO_INDEXED" = "true" ]] && echo on || echo off )
@hydra1983
hydra1983 / gulpfile.js
Last active August 29, 2015 14:07
Gulp + Browserify + Angularjs
var browserify = require('browserify');
var es6ify = require('es6ify');
var gulp = require('gulp');
var source = require('vinyl-source-stream');
gulp.task('build:libs', function(callback) {
return browserify({
entries: [
require('es6ify').runtime,
],
@hydra1983
hydra1983 / docker_images.sh
Last active August 7, 2024 06:49
Save and load docker images in batch
#!/bin/bash
readonly DB_FILE="$(pwd)/images.db"
readonly IMG_DIR="$(pwd)/images"
save-images() {
echo "Create ${DB_FILE}"
echo "$(docker images|grep -v 'IMAGE ID'|awk '{printf("%s %s %s\n", $1, $2, $3)}'|column -t)" > "${DB_FILE}"
echo "Read ${DB_FILE}"
@hydra1983
hydra1983 / sonar.properties
Created August 9, 2017 06:03
Sonar OpenLDAP Configuration
#--------------------------------------------------------------------------------------------------
# Security
sonar.security.realm=LDAP
#--------------------------------------------------------------------------------------------------
# LDAP
# General Configuration
ldap.url=ldap://myopenldap:389
ldap.bindDn=cn=admin,dc=myopenldap,dc=com
@hydra1983
hydra1983 / how-to-restore-inactive-jira-accounts-from-openldap.md
Created September 8, 2017 04:57
How to restore inactive jira accounts after openldap data is cleaned
  1. After openldap is connected from jira
  2. Create a demo account in jira, then the demo account should be created in openldap also
  3. Copy the demo account as the the inactive accounts one by one in openldap
  4. Execute UPDATE cwd_user SET active=1 WHERE CREDENTIAL='nopass' AND active=0 in jira database (MySQL)
  5. Restart jira server
  6. Reset inactive accounts password in jira
  7. Now, it should be working.