Skip to content

Instantly share code, notes, and snippets.

View ouyangzhiping's full-sized avatar

Zhiping Yang ouyangzhiping

View GitHub Profile
@ouyangzhiping
ouyangzhiping / gist:1053214
Created June 29, 2011 05:28
.zshrc文件配置示例
# Path to your oh-my-zsh configuration.
export ZSH=$HOME/.oh-my-zsh
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
# 配置theme,这是默认的theme.
export ZSH_THEME="robbyrussell"
@ouyangzhiping
ouyangzhiping / docker-gitlab.md
Last active July 20, 2021 08:14
docker-gitlab部署

docker用来隔离应用还是很方便的,一来本身的操作较为简单,二来资源占用也比虚拟机要小得多,三来也较为安全,因为像数据库这样的应用不会再全局暴露端口,同时应用间的通信通过加密和端口转发,更加安全。

Gitlab是目前比较流行的开源类Github代码管理平台。Gitlab使用Rails开发,使用PostgreSQL或MySQL数据库,Redis做缓存。一般自己搭建私有代码仓库,Gitlab通常是首选。这里简单介绍一下dockerized Gitlab。

Gitlab的docker镜像早已有人做好了,并且维护相当不错。大家可以前往其GitHub仓库了解该镜像的情况。官方repo的readme中已经有详细的安装配置方案,这里我简单的梳理一下部署流程。

安装Docker

这里以Ubuntu 14.04发行版为例,在bash中输入一下命令安装最新的docker:

@ouyangzhiping
ouyangzhiping / gist:1058219
Created July 1, 2011 10:05
10 Ruby One Liners to Impress Your Friends
#10 Ruby One Liners to Impress Your Friends
#http://programmingzen.com/2011/06/02/10-ruby-one-liners-to-impress-your-friends/
#1. Multiply each item in a list by 2
p (1..10).map {|n| n*2}
#2.Sum a list of numbers
p (1..1000).inject { |sum, n| sum + n }

灵魂选择自己的伴侣

灵魂选择自己的伴侣,少年选择自己的城市。异类需要与异类在一起。欢迎各位来参加开智部落成立典礼。今天,我要跟大家分享一位异类的故事。

我必须徒步穿越太阳系

从前有一位女孩子

从前有一位女孩子,十六岁时父亲去世,家庭陷入贫困。父亲因为感染肺结核而去世,而她自己也感染了肺结核。她一生备受病魔贫困摧残。窘迫时不得不出售自己的香水与内衣,换得稿纸。

@ouyangzhiping
ouyangzhiping / backup.md
Last active June 9, 2018 10:33
Backing Up PostgreSQL With Backup and Whatever Gems with Drobpbox api

create backup project

bundle exec backup generate:model --trigger my_backup --archives --storages='dropbox' --compressors='gzip' --notifiers='mail' --databases="postgresql"

dropbox api

https://www.dropbox.com/developers/apps

if [ -f "$rvm_path/scripts/rvm" ] && [ -f ".ruby-version" ] && [ -f ".ruby-gemset" ]; then
source "$rvm_path/scripts/rvm"
rvm use `cat .ruby-version`@`cat .ruby-gemset`
fi
// This is the main application configuration file. It is a Grunt
// configuration file, which you can learn more about here:
// https://github.com/cowboy/grunt/blob/master/docs/configuring.md
//
module.exports = function(grunt) {
grunt.initConfig({
// The clean task ensures all files are removed from the dist/ directory so
// that no files linger from previous builds.
# Usage Example: $ ddl-confreaks rubyconf2012 ~/Downloads/
# save it as /etc/profiles/ddl.confreaks.sh
##
## currently it checks for lowest resolution video mostly {640x360} and downloads it
function ddl-confreaks(){
if [ $# -ne 2 ];
then
echo 'Failed. Syntax: $> ddl-confreaks EVENT_NAME DOWNLOAD_PATH'
return
#!/usr/bin/env ruby
require 'selenium-webdriver'
require 'set'
require 'curb'
# define github credentials
github_email = 'YOUR GITHUB EMAIL ADDRESS'
github_password = 'YOUR GITHUB PASSWORD'
#!/usr/bin/env ruby
require 'mechanize'
@username = USERNAME
@password = PASSWORD
@download_path = DOWNLOAD_PATH
unless File.directory? @download_path
puts "@{download_path} doesn't exist!"