Skip to content

Instantly share code, notes, and snippets.

@jiaozhu
jiaozhu / iterm2_badges.md
Created June 23, 2018 05:52 — forked from criaturaExperimental/iterm2_badges.md
Customizing badges for iTerm2

Customizing iTerm badges

There are two variables available to use in the badge field with

\(user.gitBranch) \n \(user.humpDay)
  • gitBranch shows the current branch the folder opened in the terminal is
  • humpDay shows an icon according to the date

This code goes into ~/.bash_profile

@jiaozhu
jiaozhu / AutowiringSpringBeanJobFactory.java
Created September 29, 2016 18:04 — forked from jelies/AutowiringSpringBeanJobFactory.java
Quartz (2.1.6) java config with spring (3.2.1). Using a SpringBeanJobFactory to automatically autowire quartz classes.
package com.jelies.spring3tomcat7.config.quartz;
import org.quartz.spi.TriggerFiredBundle;
import org.springframework.beans.factory.config.AutowireCapableBeanFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.scheduling.quartz.SpringBeanJobFactory;
/**
* This JobFactory autowires automatically the created quartz bean with spring @Autowired dependencies.
@jiaozhu
jiaozhu / oracleJDBCSetup
Created September 29, 2016 15:03 — forked from MonicaG/oracleJDBCSetup
Using Oracle with Spring Boot
If you do not have an oracle driver do steps 1 and 2 first. Otherwise skip to step 3.
1) Download the jdbc driver from oracle.
2) Install the driver into your local maven .m2 repository. Example:
mvn install:install-file -DgroupId=com.oracle -DartifactId=ojdbc6 -Dversion=11.2.0.4 -Dpackaging=jar -Dfile=ojdbc6.jar -DgeneratePom=true
In the above example the ojdbc6.jar version 11.2.0.4 is used. Replace the -DartifactId=ojdbc6 -Dversion=11.2.0.4 and -Dfile=ojdbc6.jar with the driver name/version you downloaded.
@jiaozhu
jiaozhu / QNUploader.swift
Created December 4, 2015 05:41
Upload images to Qiniu via multipart-form with Alamofire
//
// QNUploader.swift
//
// Created by Lex on 12/1/15.
//
import Foundation
import Alamofire
private let kCDNDomain = "__YOUR_QINIU_CDN_DOMAIN__"
@jiaozhu
jiaozhu / placeholder
Last active August 29, 2015 14:21 — forked from oec2003/placeholder
/*! http://mths.be/placeholder v2.0.6 by @mathias */;
(function (g, i, d) {
var a = 'placeholder' in i.createElement('input'),
e = 'placeholder' in i.createElement('textarea'),
j = d.fn,
c = d.valHooks,
l, k;
if (a && e) {
k = j.placeholder = function () {
return this
#!/usr/bin/env bash
echo 'deb http://shadowsocks.org/debian wheezy main' >> /etc/apt/sources.list
# Pre-requisites
sudo apt-get -y update
sudo apt-get -y install pptpd
sudo apt-get -y install fail2ban
sudo apt-get -y install shadowsocks-libev
package com.blogspot.alotacode.scheduler;
import java.util.List;
import org.apache.log4j.Logger;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.quartz.SchedulerException;
import org.springframework.scheduling.quartz.QuartzJobBean;
@jiaozhu
jiaozhu / 0_reuse_code.js
Created June 13, 2014 23:17
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
@jiaozhu
jiaozhu / gist:9500373
Last active August 29, 2015 13:57 — forked from lucasfais/gist:1207002
Sublime Text 2 – Useful Shortcuts (Mac OS X)

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
#! /bin/bash
#====================================================================
# vps_auto_backup.sh
#
# Copyright (c) 2011, WangYan <[email protected]>
# All rights reserved.
# Distributed under the GNU General Public License, version 3.0.
#
# vps automatic local and offsite backup shell cript
#