This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def mail_body_decode(message): | |
for part in email.header.decode_header(message): | |
binary, charset = part | |
if isinstance(binary, str): | |
yield str(binary) | |
else: | |
dammit = UnicodeDammit(binary, ['utf8', 'gb2312'] + [charset]) | |
decoded_str = dammit.unicode_markup | |
yield decoded_str |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
command="php $INSTALL/indefero/scripts/gitcron.php" | |
job="0 0 * * 0 $command" | |
cat <(fgrep -i -v "$command" <(crontab -l)) <(echo "$job") | crontab - |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
image: docker:latest | |
services: | |
- docker:dind | |
build-master: | |
stage: build | |
script: | |
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY | |
- docker build --pull -t "$CI_REGISTRY_IMAGE" . | |
- docker push "$CI_REGISTRY_IMAGE" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[loggers] | |
keys=root,access | |
[handlers] | |
keys=consoleHandler,errorFileHandler,accessFileHandler,infoFileHandler | |
[formatters] | |
keys=simpleFormatter, accessFormatter | |
[logger_root] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime | |
echo ZONE=\"Asia/Shanghai\">/etc/sysconfig/clock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package me.champeau.deck2pdf; | |
import java.lang.reflect.Field; | |
import java.util.Objects; | |
import javafx.application.Application; | |
/** | |
* Adapted from https://gist.github.com/hastebrot/cbca1128dd791966e3a6 | |
*/ | |
public class HeadlessMain { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#FROM python:2.7 | |
FROM gatsbylee/centos6-python27:6.9.1 | |
USER root | |
RUN yum -y install gcc | |
RUN yum -y install mysql mysql-devel | |
ENV ORACLE_HOME=/usr/lib/oracle/11.2/client64 | |
ENV PATH=$PATH:$ORACLE_HOME/bin | |
ENV LD_LIBRARY_PATH=$ORACLE_HOME/lib |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rpm -ivh https://yum.puppetlabs.com/puppetlabs-release-pc1-el-6.noarch.rpm | |
yum -y install puppet-agent | |
ln -s /opt/puppetlabs/bin/puppet /usr/bin/puppet |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# module https://forge.puppet.com/stankevich/python | |
# $puppet module install stankevich-python --version 1.18.2 | |
# solution see https://github.com/stankevich/puppet-python/issues/233 | |
class { 'python': | |
version => 'python27', | |
pip => 'present', | |
dev => 'absent', | |
virtualenv => 'absent', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// --- Compiling --- | |
$ wget http://download.redis.io/releases/redis-2.8.3.tar.gz | |
$ tar xzvf redis-2.8.3.tar.gz | |
$ cd redis-2.8.3 | |
$ make | |
$ make install | |
// --- or using yum --- | |
$ rpm -Uvh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm | |
$ rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm |