Skip to content

Instantly share code, notes, and snippets.

View qtuancr261's full-sized avatar

Richard Thieu qtuancr261

  • #include <complex>
  • HoChiMinh City, Vietnam
  • 02:01 (UTC -12:00)
View GitHub Profile
@qingniufly
qingniufly / ByteBufferConverter.java
Created March 28, 2017 07:31
Java NIO, ByteBuffer <--> String
// ByteBuffer to String
String s = Charset.forName("UTF-8").decode(byteBuffer).toString();
// String to ByteBuffer
ByteBuffer buff = Charset.forName("UTF-9").encode("Hello, World!");
// String to ByteBuffer
public static ByteBuffer str_to_bb(String msg, Charset charset){
return ByteBuffer.wrap(msg.getBytes(charset));
@richjenks
richjenks / countries.md
Last active April 5, 2024 15:19
ISO 3166 countries by region — AMER, EMEA & APAC
Country ISO 3166 Region
Afghanistan AF EMEA
Åland Islands AX EMEA
Albania AL EMEA
Algeria DZ EMEA
American Samoa AS APAC
Andorra AD EMEA
Angola AO EMEA
Anguilla AI AMER
@Leaking
Leaking / SimpleDividerItemDecoration
Last active May 5, 2020 20:33
A simple RecyclerView ItemDecoration drawing a horizon line and you can set the height and the color.It looks like the listview divider.
package com.quinn.xmpp.ui.widget;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.drawable.Drawable;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import com.quinn.xmpp.R;
@OrangeTide
OrangeTide / showif.c
Created April 8, 2011 02:59
example to list network interfaces on linux/bsd/osx/etc
/* showif.c : PUBLIC DOMAIN - Jon Mayo - August 22, 2006
* - You may remove any comments you wish, modify this code any way you wish,
* and distribute any way you wish.*/
/* finds all network interfaces and shows a little information about them.
* some operating systems list interfaces multiple times because of different
* flags, modes, etc. if you want to use this code you should be aware that
* duplicate interfaces is a possibility */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@wimleers
wimleers / gist:706420
Created November 19, 2010 11:52
OpenTracker stats
http://tracker.driverpacks.net:6969/stats?mode=tpbs&format=ben
-> per torrent: hash (ben-encoded), complete, downloaded, incomplete
http://tracker.driverpacks.net:6969/stats?mode=tpbs&format=txt
-> per torrent: hash, seeders, leechers
http://tracker.driverpacks.net:6969/stats?mode=statedump
-> per torrent: hash, base (time in minutes since epoch when the torrent last had >0 peers, *60 = unix timestamp), downloaded