Skip to content

Instantly share code, notes, and snippets.

View imjoey's full-sized avatar
👽
Wow~

Joey imjoey

👽
Wow~
View GitHub Profile
@imjoey
imjoey / builder.go
Created June 30, 2017 14:56 — forked from vaskoz/builder.go
Golang Builder pattern
package main
import "strconv"
import "fmt"
type Color string
type Make string
type Model string
const (
#!/bin/sh
git filter-branch --env-filter '
OLD_EMAIL="your-old-email@example.com"
CORRECT_NAME="Your Correct Name"
CORRECT_EMAIL="your-correct-email@example.com"
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]
then
@imjoey
imjoey / scrapy_aliyunoss_pipeline.py
Last active September 24, 2021 07:59
aliyun oss image store for Scrapy project, like s3
# -*- coding: utf-8 -*-
import logging
logger = logging.getLogger(__name__)
import time
import six
from twisted.internet import defer, threads
from scrapy.pipelines.files import FSFilesStore, S3FilesStore
@imjoey
imjoey / java_random
Created June 10, 2015 06:36
Java random functions
package com.newcoresys.utils;
/**
* 随即数生成器
* @author huminjie
*
*/
public class RandomUtil {
/**
@imjoey
imjoey / java_des_encrypt
Created June 10, 2015 06:34
Java DES encryption
package com.newcoresys.utils;
import java.security.InvalidKeyException;
import java.security.Key;
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandaom;
import java.security.spec.InvalidKeySpecException;
import javax.crypto.Cipher;
import javax.crypto.SecretKey;
@imjoey
imjoey / java_cookie_ex
Created June 10, 2015 06:27
Java cookie utility functions
@imjoey
imjoey / java_date_ex
Created June 10, 2015 06:25
Java Date utility functions
/**
*
*/
package com.newcoresys.utils;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
@imjoey
imjoey / java_string_ex
Created June 10, 2015 06:23
Java string utility functions, with some from the internet
package com.newcoresys.utils;
import java.util.Arrays;
import java.util.List;
/**
* @Description: 字符串处理工具类
* @author: joeymac
*/
public class StringEx {
@imjoey
imjoey / mongoose_aggregate
Created June 10, 2015 06:17
aggregate by nodejs mongoose library @ mongodb
var express = require('express');
var router = express.Router();
var Task = require('../models/task');
var Auditlog = require('../models/auditlog');
var User = require('../models/user');
var auditprivileges = require('../common').audits;
var _ = require('underscore');
var mongoose = require('../common').mongoose;