Skip to content

Instantly share code, notes, and snippets.

View wupher's full-sized avatar

wupher wupher

View GitHub Profile
/usr/sbin/ntpdate ntp.91.com; /sbin/hwclock --systohc
echo "#time update add by netdragon" >> /etc/crontab
echo "0 * * * * root (/usr/sbin/ntpdate ntp.91.com; /sbin/hwclock --systohc)" >> /etc/crontab
echo "01 3 * * * root /usr/bin/yum -y update >/dev/null 2>&1" >> /etc/crontab
@wupher
wupher / FWCache.m
Created August 7, 2015 06:38
Simple Cache impl base on NSCoding
//
// FWCache.m
// CacheMeIfYouCan
//
// Created by fanwu on 15/8/7.
// Copyright (c) 2015年 ND. All rights reserved.
//
#import "FWCache.h"
#import "NSString+MD5.h"
@wupher
wupher / BinaryDataScanner.h
Created June 8, 2012 07:21 — forked from davepeck/BinaryDataScanner.h
Two simple Objective-C classes that make it crazy easy to read data from sequential binary files.
//
// BinaryDataScanner.m
//
// Copyright 2009 Dave Peck <davepeck [at] davepeck [dot] org>. All rights reserved.
// http://davepeck.org/
//
// This class makes it quite a bit easier to read sequential binary files in Objective-C.
//
// This code is released under the BSD license. If you use it in your product, please
// let me know and, if possible, please put me in your credits.
@wupher
wupher / BinaryDataScanner.h
Created June 8, 2012 07:21 — forked from davepeck/BinaryDataScanner.h
Two simple Objective-C classes that make it crazy easy to read data from sequential binary files.
//
// BinaryDataScanner.m
//
// Copyright 2009 Dave Peck <davepeck [at] davepeck [dot] org>. All rights reserved.
// http://davepeck.org/
//
// This class makes it quite a bit easier to read sequential binary files in Objective-C.
//
// This code is released under the BSD license. If you use it in your product, please
// let me know and, if possible, please put me in your credits.
@wupher
wupher / 0_reuse_code.js
Created February 1, 2017 09:24
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@wupher
wupher / new_gist_file.sql
Created February 1, 2017 09:36
Create Database and adding user for it
CREATE DATABASE `final` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
DROP DATABASE final;
CREATE USER 'fanwu'@'%' IDENTIFIED BY '123456';
GRANT ALL PRIVILEGES ON final.* TO 'fanwu';
FLUSH PRIVILEGES ;
@wupher
wupher / Application.java
Created February 1, 2017 12:22
Spring Main Application
@SpringBootApplication
public class Application extends SpringBootServletInitializer {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(Application.class);
}
@wupher
wupher / logback-spring.xml
Created February 4, 2017 03:57
colorful log
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<target>System.out</target>
<encoder>
<pattern>%date{ISO8601} %highlight([%thread] %-5level) %cyan(%logger{32}) - %msg%n</pattern>
</encoder>
</appender>
@wupher
wupher / FastJson2JsonRedisSerializer.java
Created February 14, 2017 01:58
fastjson redis serializer
public class FastJson2JsonRedisSerializer<T> implements RedisSerializer<T> {
private static final Charset DEFAULT_CHARSET = Charset.forName("UTF-8");
private Class<T> clazz;
public FastJson2JsonRedisSerializer(Class<T> clazz) {
super();
this.clazz = clazz;
}
@Override
@wupher
wupher / setenv.sh
Created March 22, 2017 13:25 — forked from terrancesnyder/setenv.sh
./setenv.sh - example setenv.sh with defaults set for minimal time spent in garbage collection
#! /bin/sh
# ==================================================================
# ______ __ _____
# /_ __/___ ____ ___ _________ _/ /_ /__ /
# / / / __ \/ __ `__ \/ ___/ __ `/ __/ / /
# / / / /_/ / / / / / / /__/ /_/ / /_ / /
#/_/ \____/_/ /_/ /_/\___/\__,_/\__/ /_/
# Multi-instance Apache Tomcat installation with a focus
# on best-practices as defined by Apache, SpringSource, and MuleSoft