Skip to content

Instantly share code, notes, and snippets.

View 20chan's full-sized avatar
🎸
rockin'

20chan 20chan

🎸
rockin'
View GitHub Profile
@20chan
20chan / crawler.py
Last active February 17, 2017 17:14
단부루 크롤링 후 사이즈 자동 변환
import json
import urllib.request
from typing import Generator
def pages(limit: int = 10, page: int = 1) -> Generator:
cur = page
while True:
url = 'https://danbooru.donmai.us/posts.json?limit={}&page={}'.format(limit, cur)
res = json.loads(urllib.request.urlopen(url).read().decode('utf-8'))
from danbooru import pages
from PIL import Image
import requests
from io import BytesIO
def get(size=(300, 300)) :
''':returns PIL.Image, 0~2 raiting level. 0 is safe, 1 is questionable, 2 is explicit.'''
p = pages(limit=100)
while True:

Keybase proof

I hereby claim:

  • I am phillyai on github.
  • I am adnim (https://keybase.io/adnim) on keybase.
  • I have a public key ASBXmfd-p-s02xrOEM9MV70yLb8eXT-on3u-XHN36E_ykgo

To claim this, I am signing this object:

foreach (string device in System.IO.Directory.GetLogicalDrives())
{
System.IO.DriveInfo dr = new System.IO.DriveInfo(device);
if (dr.DriveType != System.IO.DriveType.Removable) continue;
Console.WriteLine(dr.RootDirectory.ToString());
}
@20chan
20chan / 2d_array.c
Created June 21, 2017 00:24
c가 배열 메모리를 어떻게 처리하는가 + 신태틱 슈거 테스트
#include<stdio.h>
int main()
{
int data[3][3];
data[0][0] = 0; data[0][1] = 1; data[0][2] = 2;
data[1][0] = 3; data[1][1] = 4; data[1][2] = 5;
data[2][0] = 6; data[2][1] = 7; data[2][2] = 8;
printf("%d", data[1][2]);
printf("%d", data[0][5]);
@20chan
20chan / contract.py
Created July 2, 2017 13:50
The Fun Of Reinvention - Contract 중간 코드
class Contract:
@classmethod
def check(cls, value):
pass
class Typed(Contract):
@classmethod
def check(cls, value):
assert isinstance(value, cls.type), f'Expected {cls.type}'
@20chan
20chan / contract.py
Created July 3, 2017 06:25
The Fun of Reinvention 최종
_contracts = {}
class Contract:
@classmethod
def __init_subclass__(cls):
_contracts[cls.__name__] = cls
def __set__(self, instance, value):
self.check(value)
@20chan
20chan / ImageFlatten.py
Created July 8, 2017 15:56
Bitmap 을 Flatten하게 만들어서 1차원 배열로 만들어버리기
Bitmap b = new Bitmap(@"D:\Image\design\치워\히오스.png");
var bitmapData = b.LockBits(new Rectangle(0, 0, b.Width, b.Height), System.Drawing.Imaging.ImageLockMode.ReadWrite, b.PixelFormat);
var length = bitmapData.Stride * bitmapData.Height;
byte[] bytes = new byte[length];
// Copy bitmap to byte[]
Marshal.Copy(bitmapData.Scan0, bytes, 0, length);
b.UnlockBits(bitmapData);
@20chan
20chan / Flatten.cs
Last active July 8, 2017 16:19
이미지를 Flatten한 배열로 가져올 때 속도 비교
static Bitmap b;
static void Main(string[] args)
{
var methods = typeof(Program).GetMethods(BindingFlags.Static | BindingFlags.NonPublic);
foreach (var method in methods)
{
if (method.GetCustomAttribute<GetRuntime>() != null)
{
int range = 10;
DateTime before = DateTime.Now;
@20chan
20chan / 구상.md
Created August 1, 2017 07:09
만들고 싶은 열차 게임 구상

기차 시뮬레이터

Train Simulator는 1인칭 기차 운전에 중점을 두고 있고, 미니 메트로는 노선 디자인에 중점을 두고 있음.

https://www.youtube.com/watch?v=VzIQuzoMlqk 같은 영상을 보면 느낄 수 있는 쾌감을 제작/시뮬 둘에서 놓치지 않게 느낄 수 있도록 하고 싶음.


게임 방식