Skip to content

Instantly share code, notes, and snippets.

View lu911's full-sized avatar
🎯
Focusing

Seungchan Yuk lu911

🎯
Focusing
View GitHub Profile
public String POST(String addr, String post){
StringBuffer sb = null;
String type = "application/x-www-form-urlencoded";
HttpURLConnection urlCon = null;
BufferedReader br = null;
OutputStreamWriter wr = null;
String line = null;
try {
sb = new StringBuffer();
URL url = new URL(addr);
@lu911
lu911 / snippet.py
Created March 10, 2014 17:40
Class based SnippetList
from snippets.models import Snippet
from snippets.serializers import SnippetSerializer
from django.http import Http404
from rest_framework.views import APIView
from rest_framework.response import Response
from rest_framework import status
class SnippetList(APIView):
"""
@lu911
lu911 / gist:7885671
Created December 10, 2013 04:18 — forked from evildmp/gist:3094281

This document has now been incorporated into the uWSGI documentation:

http://uwsgi-docs.readthedocs.org/en/latest/tutorials/Django_and_nginx.html

Set up Django, nginx and uwsgi

Steps with explanations to set up a server using:

@lu911
lu911 / actor-channel.scala
Created August 29, 2013 06:30
Actor Channel Example
/*
* Copyright © 2013 Yuk SeungChan, All rights reserved.
*/
package main.scala
import scala.actors.{Channel, OutputChannel, Actor}
object Main {
def main(args: Array[String]): Unit = {
@lu911
lu911 / actor.scala
Created August 29, 2013 05:31
Actor Example ping-pong
import scala.actors.Actor
object Main {
def main(args: Array[String]): Unit = {
val pong = new Pong
val ping = new Ping(100000, pong)
ping.start
pong.start
}
@lu911
lu911 / akka-actor-test.scala
Created August 17, 2013 00:26
Akka Actor Test
import akka.actor.{Props, ActorSystem, Actor}
/*
* Copyright © 2013 Yuk SeungChan, All rights reserved.
*/
object Main {
def main(args: Array[String]): Unit = {
println("*" * 20 + " Actor Registry " + "*" * 20)
new LogGenerator().run(100)
@lu911
lu911 / crawl.py
Last active December 21, 2015 01:29
naver movie reply crawl
import re, urllib, httplib, time
class Mining(object):
r = re.compile(ur'class="score_reple">\s*<p>(.*?)</p>')
def __init__(self, code):
positive = []
negative = []
for page in range(1,2):
[positive.append(data) for data in self.get_data(code, 'highest', page)]
time.sleep(2)
@lu911
lu911 / pattern_matching.scala
Last active December 20, 2015 21:39
Pattern Matching
object Main {
def main(args: Array[String]): Unit = {
new PatternMatching()
}
}
class PatternMatching{
val methods = List(_match, _match2, guard, patternVar, patternGuardVar, typePattern, arrMatch, lstMatch, pairMatch, caseClass, optionMatch, partialFunction)
def _match(): Unit = {
@lu911
lu911 / stream.scala
Last active December 20, 2015 21:19
Stream
object Main {
def main(args: Array[String]): Unit = {
new StreamMethods()
}
}
class StreamMethods{
val methods = List(streamTest)
def numsFrom(n : BigInt): Stream[BigInt] = n #:: numsFrom(n + 1)
@lu911
lu911 / function_mapping.scala
Last active December 20, 2015 21:19
Scala Function Mapping
import scala.collection.mutable.ArrayBuffer
import scala.collection.mutable.LinkedList
import scala.collection.mutable.BitSet
import java.util.LinkedHashSet
object Main {
def main(args: Array[String]): Unit = {
new FunctionMapping()
}
}