Skip to content

Instantly share code, notes, and snippets.

View chiwanpark's full-sized avatar

Chiwan Park chiwanpark

View GitHub Profile
@chiwanpark
chiwanpark / gist:6997265
Created October 15, 2013 19:27
Keyboard Interrupt Example
while True:
try:
print "hi"
except KeyboardInterrupt:
print "bye"
import sys
sys.exit(0)
@chiwanpark
chiwanpark / preprocess.py
Created October 10, 2014 16:15
BioGRID/TCGA Preprocessing
# -*- coding: utf-8 -*-
from builtins import float, len, sum, range, set
import click
from codecs import open
from collections import defaultdict
import math
import os
@chiwanpark
chiwanpark / keybase.md
Created October 15, 2014 13:50
keybase.md

Keybase proof

I hereby claim:

  • I am chiwanpark on github.
  • I am chiwanpark (https://keybase.io/chiwanpark) on keybase.
  • I have a public key whose fingerprint is 13BE C5AB 2123 4E4A CFCF F1FC 9205 2D19 8F14 F96E

To claim this, I am signing this object:

@chiwanpark
chiwanpark / update-dnsimple
Last active March 27, 2016 10:59
Update DNSimple
#!/bin/bash
CURRENT_IP=`ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1'`
curl -H 'X-DNSimple-Token: <EMAIL>:<API_TOKEN>' \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-X PUT \
-d '{"record":{"name":"<DOMAIN_NAME>", "content":"'$CURRENT_IP'"}}' \
https://api.dnsimple.com/v1/domains/chiwanpark.com/records/<DNS_RECORD_ID> \
@chiwanpark
chiwanpark / Job.java
Created March 26, 2015 02:06
Flink example for full element as join, cogroup key
package com.chiwanpark.flink;
import org.apache.flink.api.common.functions.CoGroupFunction;
import org.apache.flink.api.common.functions.JoinFunction;
import org.apache.flink.api.java.DataSet;
import org.apache.flink.api.java.ExecutionEnvironment;
import org.apache.flink.api.java.tuple.Tuple2;
import org.apache.flink.util.Collector;
import java.io.Serializable;
@chiwanpark
chiwanpark / office365.xml
Created April 22, 2015 07:47
Office 365 Pro Plus Custom Install Configuration (Word, Powerpoint, Excel only)
<Configuration>
<Add OfficeClientEdition="64">
<Product ID="O365ProPlusRetail">
<Language ID="ko-kr"/>
<ExcludeApp ID="Access"/>
<ExcludeApp ID="InfoPath"/>
<ExcludeApp ID="Groove"/>
<ExcludeApp ID="Lync"/>
<ExcludeApp ID="OneNote"/>
<ExcludeApp ID="Outlook"/>
@chiwanpark
chiwanpark / TestSample.scala
Last active August 29, 2015 14:24
Flink Scala ANY, ALL Example
import org.apache.flink.api.common.functions.RichFilterFunction
import org.apache.flink.api.scala.{ExecutionEnvironment, _}
import org.apache.flink.configuration.Configuration
import scala.collection.JavaConversions._
case class PC(var model: String, var price: Double)
case class Laptop(var model: String, var price: Double)
@chiwanpark
chiwanpark / PartitionCustomExample.java
Created July 14, 2015 17:47
Flink Custom Partitioner Example
import org.apache.flink.api.common.functions.Partitioner;
import org.apache.flink.api.java.DataSet;
import org.apache.flink.api.java.ExecutionEnvironment;
import org.apache.flink.api.java.tuple.Tuple2;
public class PartitionCustomExample {
public static class MyPartitioner implements Partitioner<Integer> {
@Override
public int partition(Integer key, int numPartitions) {
return key % numPartitions;
@chiwanpark
chiwanpark / Example.java
Last active September 5, 2015 13:12
Example for hagersaleh
import org.apache.flink.api.common.functions.FilterFunction;
import org.apache.flink.api.common.functions.JoinFunction;
import org.apache.flink.api.java.ExecutionEnvironment;
import org.apache.flink.api.java.DataSet;
import org.apache.flink.api.java.tuple.Tuple5;
import org.apache.flink.examples.java.relational.TPCHQuery3.Customer;
import org.apache.flink.examples.java.relational.TPCHQuery3.Order;
class Example {
// TODO: NEED TO SET CORRECT PATH!
@chiwanpark
chiwanpark / Job.java
Created February 9, 2016 11:07
Flink Inherited POJO Example
package com.chiwanpark.flink;
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at