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 argparse | |
import re | |
import sys | |
import time | |
import praw | |
CLIENT_ID = 'YOUR_CLIENT_ID' | |
CLIENT_SECRET = 'YOUR_CLIENT_SECRET' | |
REDDIT_USERNAME = 'your Reddit username' |
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 praw | |
CLIENT_ID = 'YOUR_CLIENT_ID' | |
CLIENT_SECRET = 'YOUR_CLIENT_SECRET' | |
REDDIT_USERNAME = 'your reddit username' | |
# https://www.reddit.com/r/singapore/comments/8eoesx/rsingapore_random_discussion_and_small_questions/ | |
submission_id = '8eoesx' | |
reddit = praw.Reddit(client_id=CLIENT_ID, client_secret=CLIENT_SECRET, |
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 random | |
import re | |
def parse_text(text): | |
"""Returns a list of sentence chains extracted from text.""" | |
text = text.strip() | |
sentences = [] | |
for line in text.splitlines(): |
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 string | |
import random | |
import time | |
chars = string.digits + string.ascii_letters + string.punctuation + ' ' | |
iterations_per_character_revealed = 2 | |
update_delay = 0.05 | |
choices = ['Edmond To', 'Tu Yong Tan', 'Clement Chua', 'Wei Quan Ng'] |
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 time | |
from telethon import TelegramClient, events | |
# sample API_ID from https://github.com/telegramdesktop/tdesktop/blob/f98fdeab3fb2ba6f55daf8481595f879729d1b84/Telegram/SourceFiles/config.h#L220 | |
# or use your own | |
api_id = 17349 | |
api_hash = '344583e45741c457fe1862106095a5eb' | |
# fill in your own details here |
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
#!/usr/bin/env python3 | |
import os | |
import sys | |
from itertools import product | |
def read_map(s): | |
s = s.strip().split('\n') | |
l, w = (int(x) for x in s[0].split(' ')) |
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
exports.haha = function (req, res) { | |
const update = req.body; | |
console.log(JSON.stringify(update)); | |
// update contains a message | |
if (update.hasOwnProperty('message')) { | |
// call the sendMessage method | |
const reply = { | |
method: 'sendMessage', | |
chat_id: update.message.chat.id, |
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
'use strict'; | |
const pokemon = require('./pokemon.min.json'); | |
// check if id_or_name matches a pokemon's id or name | |
const match = (pokemon, id_or_name) => pokemon.id == id_or_name || pokemon.slug.includes(id_or_name.toLowerCase()); | |
// find the first matching pokemon | |
const get_pokemon = id_or_name => pokemon.find(p => match(p, id_or_name)); |
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
[{"abilities":["Overgrow"],"detailPageURL":"/us/pokedex/bulbasaur","weight":15.2,"weakness":["Fire","Flying","Ice","Psychic"],"number":"001","height":28.0,"collectibles_slug":"bulbasaur","featured":"true","slug":"bulbasaur","name":"Bulbasaur","ThumbnailAltText":"Bulbasaur","ThumbnailImage":"https://assets.pokemon.com/assets/cms2/img/pokedex/detail/001.png","id":1,"type":["grass","poison"]},{"abilities":["Overgrow"],"detailPageURL":"/us/pokedex/ivysaur","weight":28.7,"weakness":["Fire","Flying","Ice","Psychic"],"number":"002","height":39.0,"collectibles_slug":"ivysaur","featured":"true","slug":"ivysaur","name":"Ivysaur","ThumbnailAltText":"Ivysaur","ThumbnailImage":"https://assets.pokemon.com/assets/cms2/img/pokedex/detail/002.png","id":2,"type":["grass","poison"]},{"abilities":["Thick Fat"],"detailPageURL":"/us/pokedex/venusaur","weight":342.8,"weakness":["Fire","Psychic","Flying","Ice"],"number":"003","height":94.0,"collectibles_slug":"venusaur","featured":"true","slug":"venusaur","name":"Venusaur","Thumbnai |
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
from telethon import TelegramClient | |
from telethon.errors.rpc_errors_401 import SessionPasswordNeededError | |
# (1) Use your own values here | |
api_id = 17349 | |
api_hash = '344583e45741c457fe1862106095a5eb' | |
phone = 'YOUR_NUMBER_HERE' | |
username = 'username' |