Skip to content

Instantly share code, notes, and snippets.

View ihainan's full-sized avatar
😉
Hey

Jigao Fu ihainan

😉
Hey
View GitHub Profile
//1. Write an example program to demonstrate that
//package com.horstmann.impatient
//is not the same as
//package com
//package horstmann
//package impatient
// File: Demo1.scala
package com {
package horstmann {
@bmarcot
bmarcot / tsort.scala
Created July 30, 2013 11:04
Topological sort in Scala.
def tsort(gs: List[(Int, List[Int])]): List[Int] = {
gs match {
case g :: gs => {
if (g._2.isEmpty) g._1 :: tsort(gs.diff(List(g)).map(x => (x._1, x._2.diff(List(g._1)))))
else tsort(gs :+ g)
}
case _ => List()
}
}
@ishida
ishida / gist:2719962
Created May 17, 2012 16:21
change alias in keystore using keytool
$ keytool -changealias -keystore MY_KEYSTORE_2.jks -alias XXX-XXX-XXX-XXX-XXX -destalias MY_ALIAS
@Antarix
Antarix / UrlImageParser.java
Created November 29, 2012 08:48
UrlImage Parser for android TextView to load Html Image tag
import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;
import android.content.Context;
import android.graphics.Canvas;
@hardik-vala
hardik-vala / build.sbt
Created March 7, 2016 03:59
Adding Stanford CoreNLP to build.sbt
name := "myproject"
version := "1.0"
libraryDependencies ++= Seq(
"edu.stanford.nlp" % "stanford-corenlp" % "3.6.0",
"edu.stanford.nlp" % "stanford-corenlp" % "3.6.0" classifier "models"
)
@lucky
lucky / .vimrc
Created December 14, 2010 21:18
Make vim indent 2 spaces for ruby and scala files only
" Make vim indent 2 spaces for ruby and scala files only
filetype plugin indent on
set sw=4
set ts=4
:autocmd Filetype ruby set softtabstop=2
:autocmd Filetype ruby set sw=2
:autocmd Filetype ruby set ts=2
:autocmd Filetype scala set softtabstop=2
:autocmd Filetype scala set sw=2
@alphamu
alphamu / AA Transition App theme between light and dark themes
Last active September 9, 2022 21:59
Example of how to change themes at runtime with a smooth animation. In this example, we just switch between a light and a dark theme. The activity animation is defined in the theme and as such will be default on all activities with the set theme. [Demo Video here](http://youtu.be/Ps0phswbHls).
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ListView;
public class TransitionThemeActivity extends AppCompatActivity implements View.OnClickListener {
@ElementW
ElementW / uexplode.py
Created January 30, 2018 20:14
Python3 script to extract music from UE4 .uexp files
#!/usr/bin/env python3
import sys, os, errno
def mkdir_p(path):
try:
os.makedirs(path)
except OSError as exc:
if exc.errno == errno.EEXIST and os.path.isdir(path):
pass
@st-f
st-f / ThreeLevelExpandableListView.java
Last active August 15, 2023 22:52
A 3 level expandable list view
package net.stf.threelevelexpandablelistview;
import android.content.Context;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseExpandableListAdapter;
import android.widget.ExpandableListView;
@BenWoodford
BenWoodford / lh2.md
Last active October 17, 2023 02:33
Lighthouse 2.0 GATT Information

All control characteristics are under Service 00001523-1212-EFDE-1523-785FEABCD124

Characteristics

Mode = 00001524-1212-EFDE-1523-785FEABCD124 (READ, WRITE, NOTIFY)

Identify = 00008421-1212-EFDE-1523-785FEABCD124 (WRITE)

Power State = 00001525-1212-EFDE-1523-785FEABCD124 (WRITE, newer firmware also had READ and NOTIFY)