Skip to content

Instantly share code, notes, and snippets.

View Tairy's full-sized avatar
😀
Focusing

Gengrui Guo Tairy

😀
Focusing
View GitHub Profile
<?php
/**
* Created by PhpStorm.
* User: tairy
* Date: 05/01/2018
* Time: 20:23
*
* Redis 单例操作
*/
php_install_dir=/usr/local/php7
cp php.ini-production $php_install_dir/etc/php.ini
Mem=`free -m | awk '/Mem:/{print $2}'`
if [ $Mem -gt 1024 -a $Mem -le 1500 ];then
Memory_limit=192
elif [ $Mem -gt 1500 -a $Mem -le 3500 ];then
Memory_limit=256
elif [ $Mem -gt 3500 -a $Mem -le 4500 ];then
Memory_limit=320
elif [ $Mem -gt 4500 ];then
<ul class="pagination pagination-sm no-margin pull-right">
@if ($lastPage > 1)
@if ($currentPage > 1)
@for ($i = 1; $i <= $extremePagesLimit; $i++)
@if($i < $currentPage - $nearbyPagesLimit)
<li>
<a href="?page={{$i}}">{{$i}}</a>
</li>
@endif
@endfor
@Tairy
Tairy / rspec_model_testing_template.rb
Created April 14, 2016 04:24 — forked from SabretWoW/rspec_model_testing_template.rb
Rails Rspec model testing skeleton & cheat sheet using rspec-rails, shoulda-matchers, shoulda-callbacks, and factory_girl_rails. Pretty much a brain dump of examples of what you can (should?) test in a model. Pick & choose what you like, and please let me know if there are any errors or new/changed features out there. Reddit comment thread: http…
# This is a skeleton for testing models including examples of validations, callbacks,
# scopes, instance & class methods, associations, and more.
# Pick and choose what you want, as all models don't NEED to be tested at this depth.
#
# I'm always eager to hear new tips & suggestions as I'm still new to testing,
# so if you have any, please share!
#
# @kyletcarlson
#
# This skeleton also assumes you're using the following gems:
@Tairy
Tairy / Email
Created March 2, 2016 05:42 — forked from zealic/Email
class Object {
begin 777 portal.bin
M(R!796QC;VUE#0H-"B,C($ME>0T*#0I24T$@4'5B;&EC($ME>3H@*$XL(#<I
M#0I.(#T@,C,S("H@30T*32!I<R!T:&4@9W)E871E<W0@9F]U<BUD:6=I="!P
M<FEM92!T:&%T(&UA:V5S($X@96YD('=I=&@@,C,S#0H-"B,C($5N8W)Y<'1E
M9"!!=61I="!142!G<F]U<"!N=6UB97(-"@T*5&AE($%U9&ET(%%1(&=R;W5P
M(&YU;6)E<B!I<R!E;F-R>7!T960@=VET:"!T:&4@*BI24T$@4'5B;&EC($ME
M>2HJ+@T*#0I@8&`-"D-/3D-!5"A$14-265!4*#$Y-S,W,BDN=&]3=')I;F<H
M*2P@1$5#4EE05"@S,S,P-SDI+G1O4W1R:6YG*"DI#0I@8&`-"@T*(R!#05!4
M0TA!#0I5<V4@=&AI<R!G:7-T(')E=FES:6]N(&`W9#(S939E.3DY-&)B-F9A
M93@W-&1A8C,U930V9F0W-6(Y9&0Q-6)E8"!R97-U;'0@87,@0T%05$-(02X-
'''
adminreverse from here http://djangosnippets.org/snippets/2032/
changed for working with ForeignKeys
'''
'''
reverseadmin
============
Module that makes django admin handle OneToOneFields in a better way.
A common use case for one-to-one relationships is to "embed" a model
inside another one. For example, a Person may have multiple foreign
http://askubuntu.com/questions/289559/how-can-i-create-a-windows-bootable-usb-stick-with-ubuntu
@Tairy
Tairy / main.cpp
Created April 1, 2015 07:47
C++ vector
#include <iostream>
#include <vector>
using namespace std;
int main()
{
vector<int> Numvec; //定义一个整型的容器,它的类型是vector<int>
vector<int>::iterator Numer; //定义一个整型容器的迭代器,它的类型是vector<int>::iterator
int intNum;
@Tairy
Tairy / sb.cpp
Created March 31, 2015 11:22
sb
#include "rapidjson/document.h"
#include "rapidjson/writer.h"
#include <iostream>
#include "rapidjson/filereadstream.h"
#include <cstdio>
using namespace rapidjson;
int main(){
FILE* fp = fopen("factory.json", "rb");
@Tairy
Tairy / sublime-setting
Created March 8, 2015 13:17
sublime-text setting
{
"draw_white_space": "all",
"font_size": 19,
"word_wrap": "auto",
"ignored_packages":
[
"Vintage"
],
"tab_size": 2
}