This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
from bs4 import BeautifulSoup | |
import collections as cl | |
import json | |
""" | |
The export data is converted into json file of this structure. | |
/////////////// | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This code is taken from these blog. | |
# https://www.shiftedup.com/2014/11/13/how-to-bulk-remove-files-from-slack | |
# http://qiita.com/sotayamashita/items/cb811f512162e61f56f4 | |
# | |
# And I am changing the implementation a little. | |
# (It got to get arguments, and modify for Python 3) | |
import requests | |
import json | |
import calendar |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pymongo | |
import json | |
import pandas as pd | |
from bson.json_util import dumps | |
def get_co(): | |
client = pymongo.MongoClient(hostname, port) # hostname & port | |
db = client.dbname # db name | |
collection = db.collection_name # collection name | |
return collection |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Posting anonymously botn sample | |
// Confirm whether to submit a post => yes / no | |
controller.hears(['anonypost (.*)'], ['direct_message','direct_mention','mention'], function(bot,message) { | |
var matches = message.text.match(/anonypost (.*)/i); | |
var anonypost = matches[1]; | |
bot.reply(message, 'I will post this content anonymously. Is it OK? => ' + anonypost ); | |
bot.startConversation(message, function(err, convo) { | |
convo.ask('yes / no', | |
[ | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Usage: | |
// cf {color} {text} | |
// colors => black, red, green, yellow, blue, magenta, cyan, white | |
package main | |
import ( | |
"fmt" | |
"flag" | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# setup_for_ubuntu_devmachine | |
#==================================================================== | |
# Basic setting | |
#==================================================================== | |
sudo apt-get update -y && sudo apt-get upgrade -y && | |
env LANGUAGE=C LC_MESSAGES=C xdg-user-dirs-gtk-update |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*-coding: utf-8-*- | |
import glob | |
import os | |
from PIL import Image; | |
# Get all of the image files that exist under the "work" directory. | |
file_list = [r.split('/')[-1] for r in glob.glob('./work/*')] | |
for f in file_list: | |
file_extension = os.path.splitext(f) | |
target_file_extension = [".jpeg", ".jpe", ".jpg", ".JPEG",".png",".PNG",".gif",".GIF",".bmp",".BMP"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Please use "copy and paste" at Your Python environment. | |
# I have been tested with Python3. | |
# Hello World | |
python -c "print('Hello World')" | |
# Create Files(Example: Create a 10 pcs "text" file) | |
python -c "import random;[open(str(random.randint(1, 100000)) +'.txt', 'w').close() for i in list(range(10))]" | |
# Rename a all file name in the directory("jpg"file) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Random; | |
public class PasswordGenerate { | |
/** | |
* Password generate | |
* | |
* @param passLength | |
* Password length | |
* @return |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.BufferedInputStream; | |
import java.io.File; | |
import java.io.FileInputStream; | |
import java.io.FileOutputStream; | |
import java.io.IOException; | |
import java.io.InputStream; | |
import java.nio.file.Path; | |
import java.nio.file.Paths; | |
import java.util.zip.ZipEntry; | |
import java.util.zip.ZipOutputStream; |