Skip to content

Instantly share code, notes, and snippets.

Avatar

Zhiping Yang ouyangzhiping

View GitHub Profile
View yangtalk.md

灵魂选择自己的伴侣

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

我必须徒步穿越太阳系

从前有一位女孩子

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

View gist:bd9434706b45a1b5e3df
# 进行观察和选取的函数,n负责对整体进行划分,取值在1到100之间
selection <- function(n) {
raw.data <- sample(1:100,100)
first.group <- raw.data[1:n]
second.group <- raw.data[(n+1):100]
first.max <- max(first.group)
morethan.first <- second.group > first.max
my.select <- ifelse(any(morethan.first) == TRUE,
second.group[morethan.first][1],0)
return(my.select)
@ouyangzhiping
ouyangzhiping / docker-gitlab.md
Last active Jul 11, 2020
docker-gitlab部署
View docker-gitlab.md

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

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

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

安装Docker

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

View rails-grunt.js
// 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.
View gist:6208509
# 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
View peepcode.rb
#!/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!"
View railscast.rb
#!/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'
View railscasts_download.rb
#!/usr/bin/env ruby
require "nokogiri"
require "open-uri"
def download(url, output_file)
exit unless system("wget -c #{url} --load-cookies=cookies.txt -O #{output_file}")
end
def download_pages
View gist:6205515

Screencasting Framework

The following document is a written account of the Code School screencasting framework. It should be used as a reference of the accompanying screencast on the topic.

Why you should care about screencasting?

You're probably aren't going to take the time to read this document if you're not interested, but there are a lot of nice side effects caused by learning how to create quality screencasts.

  1. Communicating more effectively - At Envy Labs we produce screencasts for our clients all the time. Whether it's demoing a new feature or for a presentation for an invester, they're often much more effective and pleasent than a phone call or screen sharing.
@ouyangzhiping
ouyangzhiping / backup.md
Last active Jun 9, 2018
Backing Up PostgreSQL With Backup and Whatever Gems with Drobpbox api
View backup.md

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

You can’t perform that action at this time.