Skip to content

Instantly share code, notes, and snippets.

@fff
fff / iptables_rules.sh
Created October 21, 2016 03:39
Drop all YisouSpider request with iptables
###
# 42.156.137.50 - - [19/Oct/2016:06:25:21 +0800] "GET <URL> HTTP/1.1" 200 11959 "-" "YisouSpider"
# http://www.gxnnseo.com/post/55.html
###
iptables -I INPUT -s 42.120.160/24 -j DROP
iptables -I INPUT -s 42.120.161/24 -j DROP
iptables -I INPUT -s 42.156.136/24 -j DROP
iptables -I INPUT -s 42.156.137/24 -j DROP
iptables -I INPUT -s 42.156.138/24 -j DROP
iptables -I INPUT -s 42.156.139/24 -j DROP
@fff
fff / restart_all.sh
Last active June 12, 2016 10:55
restart several go agents in one batch
#/bin/sh
# dir structure
# |- go-agent-16.3.0_00
# |- go-agent-16.3.0_01
# |- go-agent-16.3.0_02
# |- go-agent-16.3.0_03
# |- go-agent-16.3.0_04
# |- go-agent-16.3.0_05
# |- restart_all.sh
@fff
fff / example.java
Last active November 26, 2015 15:37
add json mapping exception mapper to jax ws rs Application
////
// By default, there is only http 500 error for unrecognized properties against request object,
// without any information, it's really annoying.
////
import javax.ws.rs.core.Response;
import javax.ws.rs.ext.ExceptionMapper;
import javax.ws.rs.ext.Provider;
import com.fasterxml.jackson.databind.JsonMappingException;
@fff
fff / .bash_aliases
Last active June 22, 2016 14:37
show notifier alert
base_dir=`dirname $0`
alias ..='cd ..'
alias ...='.. && ..'
alias vi=vim
alias ga='git add'
alias gdf='git diff'
alias gs='git status'
@fff
fff / index.haml
Created November 15, 2012 14:57
A CodePen by fff. how to draw one triangle with div - draw a triangle only with css+div.
.aa
.a
.a.b
.a.b.c
.a.b.c.d
.a.b.c.d.e
.clear
.label "thin boader div"
.label "fat boader div"
.label "div with 3 boaders"
@fff
fff / index.haml
Created November 15, 2012 14:23
A CodePen by fff.
.fa
.fb
.fc
.fd
.fe
.clear
.fa.with3
.fb.with3
@fff
fff / index.html
Created November 5, 2012 03:32
A CodePen by fff.
<div class="main blue">hello world!</div>
<div class="container">yeah</div>
@fff
fff / index.html
Created November 5, 2012 02:26
A CodePen by fff.
<div class="blue outer">
<div class="yellow">fff</div>
<div class="purple margin10">FFF</div>
<div class="yellow padding10">fff</div>
</div>
<div class="outer purple">yyy</div>
@fff
fff / NoneReflection.scala
Created August 31, 2011 03:25
None.hash code was changed by java.reflection
object TestNone {
def main(args: Array[String]) {
//first none
val none1 = None
//create by reflection
val constructor = classOf[None$].getDeclaredConstructor();
constructor.setAccessible(true);
val none2 = constructor.newInstance()
@fff
fff / spec2_class_cast_exception.scala
Created June 21, 2011 06:52
java.lang.ClassCastException: scala.collection.immutable.Range$Inclusive cannot be cast to scala.collection.immutable.Range$ByOne
import org.specs.runner.JUnit4
import org.specs.SpecificationWithJUnit
class ClassCastSpec extends JUnit4(ClassCastSpec)
object ClassCastSpec extends SpecificationWithJUnit {
"test String must_== with self" in {
val data: String = "TEST_CONTENT_($*@:KFDSLU#&*@!943298742"
"TEST_CONTENT_($*@:KFDSLU#&*@!943298742" must_== data
}