Skip to content

Instantly share code, notes, and snippets.

Avatar

jhjguxin jhjguxin

View GitHub Profile
@jhjguxin
jhjguxin / how_to_display_and_kill_zombie_processes.md
Last active Dec 23, 2021
Zombie processes are undead, scary killing them isn't so easy
View how_to_display_and_kill_zombie_processes.md

How to display and kill zombie processes

finding if zombies exist

  • execute the top command
  • one line is tasks:
    • Example output: Tasks: 63 total, 1 running, 61 sleeping, 0 stopped, 1 zombie

Who is zombie

@jhjguxin
jhjguxin / gpg-tour.md
Created Jul 19, 2013
GPG 加密解密简明教程 </br> 作者: riku / 本文采用CC BY-NC-SA 2.5协议 授权
View gpg-tour.md

GPG 加密解密简明教程

大家都知道,互联网上充斥着大量的明文传输方式,可以说绝对是不安全地带。那么,我们如何保证在不安全的互联网中更可靠的传输重要数据呢?个人认为最好的方式之一就是使用 GPG 工具进行加密。此文只是简单介绍了 GPG 的常规用法,重在推广和普及 GPG 加密工具,详细的使用请参见 GPG 手册。

名词解释

RSA / DSA / ElGamal : 是指加密算法

GPG :(全称 GnuPG ) 是一款非对称加密(PGP)的免费软件,非对称加密方式简单讲就是指用公钥加密文件,用私钥解密文件。如果你想给谁发送加密信息,首先你要得到他的公钥,然后通过该公钥加密后传给他,对方利用自已的私钥就可解密并读取文件了。

@jhjguxin
jhjguxin / creating-nested-resources-in-ruby-on-rails-3-and-updating-scaffolding-links-and-redirection.markdown
Created Jul 9, 2012
Creating nested resources in ruby on rails 3 and updating scaffolding links and redirection
View creating-nested-resources-in-ruby-on-rails-3-and-updating-scaffolding-links-and-redirection.markdown
@jhjguxin
jhjguxin / rails3_with_dalli.md
Created Nov 19, 2013
Config Rails 3 with dalli(memcahed)
View rails3_with_dalli.md

Config Rails 3 with dalli(memcahed)

To install dalli in your Rails 3 app, simply add the following to your Gemfile and run bundle install.

# Gemfile
gem "dalli", "~> 2.6.4",   :platforms => :ruby

To setup Rails to use the Dalli client for production, add the following to config/environments/production.rb:

@jhjguxin
jhjguxin / date_time.js
Created Jan 10, 2013
js上周(月、季)、上上周(月、季)、去年同期上周(月、季)
View date_time.js
/***
* 获得当前时间
*/
function getCurrentDate(){
return new Date();
};
//今年以来的起止时间段
function getThisYear(){
//起止日期数组
@jhjguxin
jhjguxin / Rakefile
Created Jun 20, 2012
how to resque
View Rakefile
#No such file to load -- devise/confirmations_controller
#resque worker devise not eager loading
require File.expand_path('../config/application', __FILE__)
require 'rake/dsl_definition'
require 'resque/tasks'
Askjane::Application.load_tasks
task "resque:setup" => :environment do
@jhjguxin
jhjguxin / generate_source_tracker.rb
Last active Oct 1, 2020
delegate demo, use helpers and url_helper outside controller or helpers ....
View generate_source_tracker.rb
## rails runner script/generate_source_tracker_link.rb
#eg: version_number: 20130116-1-1 #data-1(早)/2(晚)-1(article_number)
class GeneraterSourceTracker
#include ActionView::Helpers
#include ActionView::Helpers::UrlHelper
include Rails.application.routes.url_helpers
delegate :url_helpers, to: 'Rails.application.routes'
delegate :helpers, to: 'ActionController::Base'
def tracker_url(source_tracker)
@jhjguxin
jhjguxin / mysql-status.md
Last active Sep 15, 2020
通过show status 来优化MySQL数据库 from lxneng
View mysql-status.md
  1. 查看MySQL服务器配置信息
mysql> show variables;
  1. 查看MySQL服务器运行的各种状态值
mysql> show global status;