Skip to content

Instantly share code, notes, and snippets.

View watosar's full-sized avatar

watosar watosar

  • Japan
View GitHub Profile
@watosar
watosar / calculator.py
Last active October 30, 2018 08:55
電卓的
[
[
print(
glo['RPN'](glo['translate'](glo['text_0']).split(':'))
)
for i in ['']
] for glo in [{}]
if not(
glo.update({
'text':input('>'),
@watosar
watosar / RPN_2.py
Last active October 30, 2018 11:08
逆ポーランド記法電卓的
(lambda I=None:[
[
loc['stac']
if not loc['loop'].close()
else None
for i in loc['loop']
if
i == 'end'
or
@watosar
watosar / eval_bot.py
Created August 20, 2018 16:13
discordBot
# -*- coding: utf-8 -*-
import discord
import asyncio
asyncio.set_event_loop(asyncio.new_event_loop())
client = discord.Client()
flg = True
origin_send_message = client.send_message
client.send_message =lambda *args,**kwargs:(origin_send_message(*args,**kwargs),globals().__setitem__('flg',False))[0]
send_message = lambda *args,**kwargs:asyncio.ensure_future(client.send_message(*args,**kwargs))
@watosar
watosar / onelner_2.py
Created August 20, 2018 16:01
discordBot
(lambda **kw:[globals().update(kw),logging.basicConfig(level=logging.INFO),asyncio.set_event_loop(asyncio.new_event_loop()),(lambda client:[[(lambda func,name:client.event(asyncio.coroutine(types.LambdaType(func.__code__,globals(),name,None,(func.__closure__)))))(*item) for item in [[(lambda msg:{True:lambda:asyncio.ensure_future(client.send_message(msg.channel,'pong')) if msg.content == 'ping' else None,False:lambda :None}[msg.author != client.user]()),'on_message'],[lambda :print(f'account is {client.user}'),'on_ready']]],client.run('token')])(discord.Client())])(**{i:__import__(i) for i in ['logging','asyncio','discord','types']})
@watosar
watosar / oneliner_1.py
Last active August 20, 2018 16:02
discordBot
(lambda **kw:(globals().update(kw),logging.basicConfig(level=logging.INFO),asyncio.set_event_loop(asyncio.new_event_loop()),type('client',(discord.Client,),{'on_ready':asyncio.coroutine(lambda self:print(f'account is {self.user}')),'on_message':asyncio.coroutine(lambda self,msg:asyncio.ensure_future(self.send_message(msg.channel,'pong'))if msg.author != self.user and msg.content == 'ping' else None)})().run('token')))(**{i:__import__(i) for i in ['logging','asyncio','discord']})