Skip to content

Instantly share code, notes, and snippets.

View undownding's full-sized avatar
🤣
C'est la vie

undownding undownding

🤣
C'est la vie
View GitHub Profile
@undownding
undownding / get_ip.sh
Created July 29, 2015 05:11
Get IP address from hostname
nslookup shadowsocks.org | awk -F': ' 'NR==6 { print $2 } '
@undownding
undownding / dns-clean.sh
Created August 3, 2015 03:06
dns-clean.sh
#!/bin/ash
#这行是用一个不存在的域名解析来钓出强制跳转地址
NONEXISTDOMAIN="non.exist.domain.cn"
#这行写入一些会被污染的域名
POSIONEDDOMAIN="www.twitter.com www.facebook.com www.youtube.com plus.google.com"
#下面这行写入本地的DNS地址,即被污染的DNS服务地址
@undownding
undownding / code.kt
Last active January 26, 2016 05:00
Recyclerview auto load more when scroll to bottom
inner class OnScrollListener(): RecyclerView.OnScrollListener() {
var isLoadingMore = false
override fun onScrolled(recyclerView: RecyclerView?, dx: Int, dy: Int) {
val lastVisibleItem: Int = (recyclerView?.layoutManager as LinearLayoutManager).findLastVisibleItemPosition()
val totalItemCount: Int = (recyclerView?.layoutManager as LinearLayoutManager).itemCount
if (lastVisibleItem >= totalItemCount - 4 && dy > 0) { // 4 items left to the bottom.
if (!isLoadingMore) { // not lock, load more.
@undownding
undownding / styles.xml
Created January 26, 2016 06:00
Modify NavigationBar color
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="android:navigationBarColor">@color/colorPrimaryDark</item>
</style>
865a866,874
> // 1dmy
> {
> prefix: "gitlab.1dmy.com:10022/",
> re: `^(?P<root>gitlab\.1dmy\.com:10022/[A-Za-z0-9_.\-]+/[A-Za-z0-9_.\-]+)(/[A-Za-z0-9_.\-]+)*$`,
> ping: false,
> vcs: "git",
> repo: "ssh://git@gitlab.1dmy.com:10022/{p}.git",
> },
>
@undownding
undownding / nginx.conf
Created May 4, 2016 05:07
Use nginx to get ip
server {
server_name ip.lustfield.net;
location = / {
default_type text/plain;
echo $remote_addr;
}
}
package com.common.adapter;
import android.databinding.DataBindingUtil;
import android.databinding.ViewDataBinding;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import java.util.List;
# default combined nginx log_format:
#log_format combined '$remote_addr - $remote_user [$time_local] '
# '"$request" $status $body_bytes_sent '
# '"$http_referer" "$http_user_agent"';
log_format joyent '$remote_addr - $remote_user [$time_local] '
'$request "$status" $body_bytes_sent '
'"$http_referer" "$http_user_agent" "$http_x_forwarded_for"';
log_format nodejs '$remote_addr - $remote_user [$time_local] '
package com.common.rx;
import rx.Subscriber;
/**
* Created by undownding on 16-6-8.
*/
public class SubscriberBuilder<T> {
private OnNextListener next;
private OnErrorListener error;
package me.undownding.music.model
import android.util.Log
import com.baidu.music.model.Album
import com.baidu.music.model.Music
import com.baidu.music.onlinedata.OnlineManagerEngine
import com.baidu.music.onlinedata.PlayinglistManager
import me.undownding.music.MusicApplication
import me.undownding.music.ext.RetrofitFactory
import retrofit2.http.GET