Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View alanljj's full-sized avatar
🎯
Focusing

ITGeeker alanljj

🎯
Focusing
View GitHub Profile
@alanljj
alanljj / Automated_Backup_Postgresql_on_Windows.bat
Created April 10, 2017 10:48
Automated_Backup_Postgresql_on_Windows
@echo off
for /f "tokens=1-4 delims=/ " %%i in ("%date%") do (
set dow=%%i
set month=%%j
set day=%%k
set year=%%l
)
set datestr=%month%_%day%_%year%
echo datestr is %datestr%
@alanljj
alanljj / .stglobalignore
Created September 6, 2017 02:21 — forked from jult/.stglobalignore
syncthing ignore file(s) .stglobalignore and .stignore
// .stglobalignore
// Incomplete Downloads and such.
// For now, these prevent Syncthing from transferring data that's
// going to be thrown out anyway once the download is finished and the
// file is renamed. Stuff may alter when Syncthing gets smarter.
//
// Firefox downloads and other things
*.part
// Chrom(ium|e) downloads
@alanljj
alanljj / re.py
Created November 11, 2017 14:41 — forked from dervn/re.py
Python中过滤HTML标签的函数
#用正则简单过滤html的<>标签
import re
str = "<img /><a>srcd</a>hello</br><br/>"
str = re.sub(r'</?\w+[^>]*>','',str)
print str
@alanljj
alanljj / postgres
Created January 15, 2018 02:32 — forked from mmrwoods/postgres
Postgres maintenance crontab file
# dump all databases once every 24 hours
45 4 * * * root nice -n 19 su - postgres -c "pg_dumpall --clean" | gzip -9 > /var/local/backup/postgres/postgres_all.sql.gz
# vacuum all databases every night (full vacuum on Sunday night, lazy vacuum every other night)
45 3 * * 0 root nice -n 19 su - postgres -c "vacuumdb --all --full --analyze"
45 3 * * 1-6 root nice -n 19 su - postgres -c "vacuumdb --all --analyze --quiet"
# re-index all databases once a week
0 3 * * 0 root nice -n 19 su - postgres -c 'psql -t -c "select datname from pg_database order by datname;" | xargs -n 1 -I"{}" -- psql -U postgres {} -c "reindex database {};"'
@alanljj
alanljj / mysql-docker.sh
Created February 28, 2018 09:50 — forked from spalladino/mysql-docker.sh
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@alanljj
alanljj / lychee
Created March 15, 2018 06:33 — forked from ottonet/lychee
lychee nginx config
server {
server_name my.lychee.site;
listen 80;
root /var/www/my.lychee.site/htdocs;
access_log /var/www/my.lychee.site/logs/access.log;
error_log /var/www/my.lychee.site/logs/error.log;
index index.php index.html;
@alanljj
alanljj / wp-permissions-script
Created May 16, 2018 02:47 — forked from macbleser/wp-permissions-script
WordPress Permissions Configuration Script
#!/bin/bash
#
# This script configures WordPress file permissions based on recommendations
# from http://codex.wordpress.org/Hardening_WordPress#File_permissions
#
# Author: Michael Conigliaro
#
WP_OWNER=changeme # &lt;-- wordpress owner
WP_GROUP=changeme # &lt;-- wordpress group
WP_ROOT=/home/changeme # &lt;-- wordpress root directory
@alanljj
alanljj / user-rule.txt
Created August 30, 2016 08:40
Shadowsocks 用户自定义翻墙规则
@@||ithome.com
||jsfiddle.net
||go.com
||cloudfront.net
||live.com
||coursera.org
||fluidui.com
@@||temp.im
||uxpin.com
||slack.com
# -*- coding: utf-8 -*-
###########################################################################
# GeekerMaster奇客大师 www.geekermaster.com
# Copyright 2018 ITGeeker <alanljj@gmail.com>
############################################################################
from openerp import models, fields, api
class GeekerRmbCapital(models.Model):
_name = 'geeker.rmb.capital'
_description = 'Geeker RMB Capital'
#!/bin/bash
# Note: create by itgeeker
domain=mail.itgeeker.net
su - zimbra -c 'zmproxyctl stop'
su - zimbra -c 'zmmailboxdctl stop'
mkdir /opt/zimbra/ssl/aliyunssl/
echo "up load aliyun ssl other to this folder first !!!!!!!"