Skip to content

Instantly share code, notes, and snippets.

View cyk1337's full-sized avatar
🎯
Focusing

cyk cyk1337

🎯
Focusing
View GitHub Profile
#!/usr/bin/env python
# -*- encoding: utf-8
'''
_____.___._______________ __.____ __________ _________ ___ ___ _____ .___
\__ | |\_ _____/ |/ _| | \ \ \_ ___ \ / | \ / _ \ | |
/ | | | __)_| < | | / | \ / \ \// ~ \/ /_\ \| |
\____ | | \ | \| | / | \ \ \___\ Y / | \ |
/ ______|/_______ /____|__ \______/\____|__ / \______ /\___|_ /\____|__ /___|
@cyk1337
cyk1337 / BNCRequest.py
Created March 11, 2019 05:56
Count and save phrase occurrences from BNC corporus
#!/usr/bin/python3
# -*- coding: utf-8 -*-
"""
_____.___._______________ __.____ __________ _________ ___ ___ _____ .___
\__ | |\_ _____/ |/ _| | \ \ \_ ___ \ / | \ / _ \ | |
/ | | | __)_| < | | / | \ / \ \// ~ \/ /_\ \| |
\____ | | \ | \| | / | \ \ \___\ Y / | \ |
/ ______|/_______ /____|__ \______/\____|__ / \______ /\___|_ /\____|__ /___|
\/ \/ \/ \/ \/ \/ \/
@cyk1337
cyk1337 / mt_2-3_layer_no_dropout
Created February 21, 2018 11:29
MT_coursework
/afs/inf.ed.ac.uk/user/s17/s1718204/miniconda3/envs/mtenv/bin/python3.4 /afs/inf.ed.ac.uk/user/s17/s1718204/PycharmProjects/MT_2/INFR11062/nmt_translate.py
Japanese English dataset configuration
vocab size, en=3713, fr=3949
--------------------------------------------------
Training progress will be logged in:
model/train_10000sen_2-3layers_100units_ja_en_exp1_NO_ATTN.log
--------------------------------------------------
Trained model will be saved as:
model/seq2seq_10000sen_2-3layers_100units_ja_en_exp1_NO_ATTN.model
--------------------------------------------------
/afs/inf.ed.ac.uk/user/s17/s1718204/miniconda3/envs/mtenv/bin/python3.4 /afs/inf.ed.ac.uk/user/s17/s1718204/PycharmProjects/MT/MT/nmt_translate.py
Japanese English dataset configuration
vocab size, en=3713, fr=3949
--------------------------------------------------
Training progress will be logged in:
model/train_10000sen_2-3layers_100units_ja_en_exp1_NO_ATTN.log
--------------------------------------------------
Trained model will be saved as:
model/seq2seq_10000sen_2-3layers_100units_ja_en_exp1_NO_ATTN.model
--------------------------------------------------
@cyk1337
cyk1337 / shodan_ip.py
Last active May 4, 2017 09:27
simulated login shodan
# -*- coding:utf-8 -*-
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
import time
def sd_login_and_search(entry_url, username, password ):
@cyk1337
cyk1337 / deRepeat.py
Last active March 30, 2017 11:14
De-repeat text files
#-*- coding: utf-8 -*-
import os
#de-repeat and return a non-repeated list
def de_repeat(filename):
li=[]
if os.path.isfile(filename):
try:
with open(filename) as f:
for line in f:
@cyk1337
cyk1337 / deRepeat.py
Created March 1, 2017 11:59
De-repeat text files
import os
def de_repeat(filename):
li=[]
if os.path.isfile(filename):
try:
with open(filename) as f:
for line in f:
l=line.lstrip()
@cyk1337
cyk1337 / countNum.py
Created March 1, 2017 11:58
Count sub-file numbers of a directory | | count line numbers of a file
import os
#count line number of a file
def count_txt_line(filename):
try:
with open(filename) as f:
count=len(f.readlines())
except IOError as e:
print e
return count
@cyk1337
cyk1337 / IELTS-SpeakingTopicsPoolScraping
Created February 28, 2017 03:31
Hello guys, this bot is for scraping IELTS test speaking topics card automatically. Good luck~~
import urllib2,os
from bs4 import BeautifulSoup
import requests
def download_img(url):
headers={
'Cookie':'_yasi_website_session=NE5pZU1zdEwySVlzUzRaOVl3eUNTTitQNE05eTcwdjUvNHBXbUJiNGt6QVVpOEV1UTlhMWR6aGZKVzlYVm10VTdWd2ZKOUtDTVhLeEIrOEd3ZUlocWhtLzcyb05TaHp1dVlCak11bW5wby9aWVBQSzZvNCtraHZ6ZGkzRTI4cUxtbTN5cXpqWlp2dXNVRytTZDhXRUU1QkhFSFpWTjdkNmY3UlpOZkw4VUdGb2lmVnJoUTBxa0RSV3ZlWHBjbGY4bUF6TzdwZVVyNnZKSUdvNklFbkkzYXAvdFl3TGNTUFluYWtsUEEzWjZRbExwZ3FORXV1QnNOYlpNVzRWNmpIUDdJR2tjUTVxVG9xTGdUZVhOWVBpdklDUXRhamNqOEJzWlAzblJkUDVsMThieDdueTEwbHhhMHNGcUo2dnBHREhVcm9mcld5OU9EOG03MTlMUG9FWXp3PT0tLXVJTHVvcmVrSk9VendEOVBtaGxKWGc9PQ%3D%3D--9462f8c529da941685976ccf6235f2bceda22298; CNZZDATA1260900061=1970134767-1488189272-%7C1488194905',
'Host':'ieltsbro.com',
'If-Modified-Since':'Mon, 09 Jan 2017 10:00:42 GMT',
@cyk1337
cyk1337 / GetWinWallPaper.py
Created February 28, 2017 03:27
Get Windows Locking Screen Wall Papers
import os
paperDir="C:\\Users\\%yourPCname%\\AppData\\Local\Packages\\Microsoft.Windows.ContentDeliveryManager_cw5n1h2txyewy\\LocalState\\Assets\\"
desPath='C:\\Users\\%yourPCname%\\Pictures\\'
if not os.path.exists(desPath):
os.mkdir(desPath)
os.system('cp -r '+paperDir+' '+desPath)
countAll=0