Skip to content

Instantly share code, notes, and snippets.

View qichunren's full-sized avatar
🌈
Focusing contribute

Qichunren qichunren

🌈
Focusing contribute
View GitHub Profile
#!/usr/bin/env bash
# inspired by
# https://gist.github.com/JannikArndt/feb720c1f5d210b4820b880af23f2a07
# which was inspired by
# https://github.com/fwartner/mac-cleanup/blob/master/cleanup.sh
# https://gist.github.com/jamesrampton/4503412
# https://github.com/mengfeng/clean-my-mac/blob/master/clean_my_mac.sh
# https://github.com/szymonkaliski/Dotfiles/blob/master/Scripts/clean-my-mac
# http://brettterpstra.com/2015/10/27/vacuuming-mail-dot-app-on-el-capitan/ / https://github.com/pbihq/tools/blob/master/MailDBOptimiser.sh
@qichunren
qichunren / generate-ssh-key.sh
Created February 9, 2020 05:26 — forked from grenade/01-generate-ed25519-ssh-key.sh
Correct file permissions for ssh keys and config.
ssh-keygen -t rsa -b 4096 -N '' -C "rthijssen@gmail.com" -f ~/.ssh/id_rsa
ssh-keygen -t rsa -b 4096 -N '' -C "rthijssen@gmail.com" -f ~/.ssh/github_rsa
ssh-keygen -t rsa -b 4096 -N '' -C "rthijssen@gmail.com" -f ~/.ssh/mozilla_rsa
@qichunren
qichunren / php_cgi
Last active December 26, 2015 09:38 — forked from cea2k/php_cgi
not have daemon command.
#!/bin/sh
#
# php-cgi - php-fastcgi swaping via spawn-fcgi
#
# chkconfig: - 85 15
# description: Run php-cgi as app server
# processname: php-cgi
# config: /etc/sysconfig/phpfastcgi (defaults RH style)
# pidfile: /var/run/php_cgi.pid
# Note: See how to use this script :
@qichunren
qichunren / virtual_hosts_osx.md
Created November 16, 2012 04:34 — forked from trey/virtual_hosts_osx.md
The Absolute Least You Need to Do to Use Virtual Hosts on OS X

The Absolute Least You Need to Do to Use Virtual Hosts on OS X

Enable Web Sharing in System Preferences > Sharing. (No need to do this in Mountain Lion. You may need to run sudo apachectl start, though.)

Edit these files:

  • /etc/apache2/httpd.conf
  • /etc/hosts
  • /etc/apache2/users/your-username.conf
  • In Mountain Lion, you'll need to copy Guest.conf to [your-username].conf. Also, be sure to change the first line to be `` and then also create the ~/Sites folder (which will, magically, still have the correct folder icon with the compass on it).
@qichunren
qichunren / carrierwave.rb
Created December 21, 2011 06:52 — forked from yortz/carrierwave.rb
image_uploader.rb
#config/initializers/carrierwave.rb
CarrierWave.configure do |config|
if Rails.env.production? or Rails.env.development?
config.storage :cloud_files
config.cloud_files_username = "your_username"
config.cloud_files_api_key = "your_key"
config.cloud_files_container = "test"
config.cloud_files_cdn_host = "c0012345.cdnn.cloudfiles.rackspacecloud.com"
def store_dir
@qichunren
qichunren / 脚本验证.html
Created September 16, 2011 13:12 — forked from hare1987/脚本验证.html
脚本验证
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script language="javascript">
function checkregform(){
alert("验证开始了!");
if (document.yx.name.value==""){
alert("请填写宝宝的姓名!");
require "thor/shell"
say("Modifying a new Rails app ...", :yellow)
#----------------------------------------------------------------------------
# Configure
#----------------------------------------------------------------------------
=begin
unless options[:database] == 'sqlite3'
username = ask("What's your database username[root]")
username = 'root' if username.blank?
@qichunren
qichunren / Pager object example
Created February 26, 2010 09:55 — forked from anonymous/Pager object example
simple php framework的分页
<?PHP
// First off, how many items per page?
$per_page = 4;
// Next, get the total number of items in the database
$num_videos = $db->getValue("SELECT COUNT(*) FROM videos where status = 'approved' ORDER BY dt");
// Initialize the Pager object
$pager = new Pager($_GET['p'], $per_page, $num_videos);