Skip to content

Instantly share code, notes, and snippets.

View LenKIM's full-sized avatar
🐋
small step make a big difference👣

simplify-len LenKIM

🐋
small step make a big difference👣
View GitHub Profile
/*
* Copyright (c) 2015, Nordic Semiconductor
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
@LenKIM
LenKIM / [android] BitmapToDrawable.txt
Last active December 26, 2016 10:42
[android] BitmapToDrawable
//비트맵을 drawable로 변환하는 함수
public Drawable getDrawableFromBitmap(Bitmap bitmap){
Drawable drawable = new BitmapDrawable(bitmap);
return drawable;
}
//Drawable 을 Bitmap으로 변환하는 함수
public static Bitmap drawableToBitmap (Drawable drawable){
if (drawable instanceof BitmapDrawable){
return ((BitmapDrawable)drawable).getBitmap();
@LenKIM
LenKIM / RecyclerViewLastPostionHelper.txt
Last active January 15, 2017 07:21
RecyclerViewLastPostionHelper
/**
* Custom Scroll listener for RecyclerView.
* Based on implementation https://gist.github.com/ssinss/e06f12ef66c51252563e
*/
public abstract class EndlessRecyclerOnScrollListener extends RecyclerView.OnScrollListener {
public static String TAG = "EndlessScrollListener";
private int previousTotal = 0; // The total number of items in the dataset after the last load
private boolean loading = true; // True if we are still waiting for the last set of data to load.
private int visibleThreshold = 5; // The minimum amount of items to have below your current scroll position before loading more.
@LenKIM
LenKIM / MultiProcesses
Last active September 18, 2018 01:29
[파이썬] 아웃풋이 되는 공유자원-리스트를 얻기 위한 멀티스레드 VS 멀티 프로세스 비교
#!/usr/bin/python3
import glob
import multiprocessing
import os
import time
from typing import List
from tqdm import tqdm
@LenKIM
LenKIM / 파일 분할.py
Created September 17, 2018 02:48
시간별로 로그 파일 분할하기
# -*- coding: utf-8 -*-
# !/usr/bin/env python3
class PreprocessorHelper:
def __init__(self) -> None:
super().__init__()
def file_classification_by_datetime(self):
a_total = []
@LenKIM
LenKIM / main_tests.py
Created September 17, 2018 02:58
파싱테스트 관련 자료
#!/usr/bin/python3
# Normal
def test_custom_parser(self):
file_paths = glob.glob("/Users/len/log-analyer-assignment/logdata/20180824/*.txt", recursive=False)
start_time = time.time()
for file_path in file_paths:
with open(str(file_path), 'r', encoding='utf8') as infile:
lines = infile.readlines()
for row_list in tqdm(lines):
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonParser;
import com.sun.media.jfxmediaimpl.MediaDisposer;
import io.reactivex.Observable;
import io.reactivex.disposables.Disposable;
import io.reactivex.functions.Function;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
@LenKIM
LenKIM / file_helpers.py
Last active January 18, 2019 09:13
How to use Callable Object
class Geek:
def __init__(self, bb, cc, dd) -> None:
super().__init__()
self.bb = bb
self.cc = cc
self.dd = dd
self.input = ""
self.print_go(bb, cc, dd)
@LenKIM
LenKIM / crwaling.py
Created June 11, 2019 01:12
crawling_test.py
# -*- coding: utf-8 -*-
# !/usr/bin/env python3
import re
from random import choice
import os.path
import requests
from lxml import etree
from bs4 import BeautifulSoup
// BEGIN imp_classifier
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
public class ImpNumberClassifierSimple {
private int _number; //<1>
private Map<Integer, Integer> _cache; //<2>