Skip to content

Instantly share code, notes, and snippets.

View neoneo40's full-sized avatar

neo neoneo40

  • Seoul, Korea
View GitHub Profile
@bavernet
bavernet / ITES
Created December 22, 2014 11:35
q = [0] * 5000000
def solve(k, n):
ss = 0
cnt = 0
prev = 1983
front = 0
rear = 0
for i in xrange(n):
num = prev % 10000 + 1
def gen_data():
a = 1983
po = pow(2, 32)
while True:
yield a % 10000 + 1
a = (a * 214013 + 2531011) % po
def do_case(k, n):
head = gen_data().next
@bjorgvino
bjorgvino / yosemite ntfs read+write.txt
Last active December 2, 2021 03:58
osxfuse + ntfs-3g + Yosemite = NTFS R/W
Remove osxfuse if installed via homebrew:
> brew uninstall osxfuse
Install osxfuse binary and choose to install the MacFUSE compatibility layer:
http://sourceforge.net/projects/osxfuse/files/latest/download?source=files
Reboot (optional but recommended by osxfuse)
Install ntfs-3g via homebrew:
> brew update && brew install ntfs-3g
@jmjeong
jmjeong / toc.py
Last active October 26, 2015 03:07
markdown toc generator
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# markdown toc generator, v1.8
#
# Jaemok Jeong, 2014/10/27
from AppKit import NSPasteboard, NSArray
import re
import argparse
@cornchz
cornchz / scraper.py
Last active May 1, 2018 12:13
[PyConKR 2014] 30분만에 따라하는 동시성 스크래퍼
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from gevent import monkey; monkey.patch_all()
import re
from urlparse import urljoin
from gevent.pool import Pool
import requests
@devxoul
devxoul / korail.py
Last active January 24, 2023 08:39
[Deprecated] 코레일 승차권 검색 및 예매 프로그램. https://github.com/devxoul/korail
# -*- coding: utf-8 -*-
"""
This code won't be updated anymore.
Project has moved to repository: https://github.com/devxoul/korail
"""
import requests
from bs4 import BeautifulSoup
from datetime import datetime
@st4lk
st4lk / root_logger_settings.py
Last active May 2, 2024 15:25
Python logging settings for root logger
"""
Settings for root logger.
Log messages will be printed to console and also to log file (rotated, with
specified size). All log messages from used libraries will be also handled.
Three approaches for defining logging settings are used:
1. using logging classes directly (py25+, py30+)
2. using fileConfig (py26+, py30+)
3. using dictConfig (py27+, py32+)
Choose any variant as you like, but keep in mind python versions, that
@jordan-wright
jordan-wright / check_hosts.py
Last active February 16, 2019 15:38
Fabric Botnet C&C Blog Post
def check_hosts():
''' Checks each host to see if it's running '''
for host, result in execute(run_command, "uptime", hosts=env.hosts).iteritems():
running_hosts[host] = result if result.succeeded else "Host Down"
@adamjohnson
adamjohnson / publickey-git-error.markdown
Last active January 30, 2025 00:44
Fix "Permission denied (publickey)" error when pushing with Git

"Help, I keep getting a 'Permission Denied (publickey)' error when I push!"

This means, on your local machine, you haven't made any SSH keys. Not to worry. Here's how to fix:

  1. Open git bash (Use the Windows search. To find it, type "git bash") or the Mac Terminal. Pro Tip: You can use any *nix based command prompt (but not the default Windows Command Prompt!)
  2. Type cd ~/.ssh. This will take you to the root directory for Git (Likely C:\Users\[YOUR-USER-NAME]\.ssh\ on Windows)
  3. Within the .ssh folder, there should be these two files: id_rsa and id_rsa.pub. These are the files that tell your computer how to communicate with GitHub, BitBucket, or any other Git based service. Type ls to see a directory listing. If those two files don't show up, proceed to the next step. NOTE: Your SSH keys must be named id_rsa and id_rsa.pub in order for Git, GitHub, and BitBucket to recognize them by default.
  4. To create the SSH keys, type ssh-keygen -t rsa -C "[email protected]". Th
@natewalck
natewalck / example.py
Created May 21, 2013 15:43
Examples for Practical Python for Mac Admins
# Numbers
number1 = 7
number2 = .256
number3 = -1024
number1 + number2 + number3
number1 < number2
number2 == number3
# Strings