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'; | |
| function deleteDMsByChannelId() { | |
| const user_id = ''; // User ID : Uxxxxxxxxx | |
| const token = ''; // Slack API の Userトークン : xoxp-xxxxx | |
| const channel_id = ''; // チャンネルID(DMの中のメッセージのリンクの「archive/Dxxxx」の部分) | |
| let has_more = true; | |
| let list_options = { | |
| 'method': 'post', |
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
| CREATE TEMPORARY FUNCTION STR2DATE(x STRING) RETURNS DATE | |
| AS ( | |
| CASE | |
| WHEN REGEXP_CONTAINS( | |
| x, | |
| r'(19|20)[[:digit:]]{2}\-*(0[1-9]|1[0-2])\-*(0[1-9]|[12][0-9]|3[01])') | |
| THEN | |
| DATE(CAST(SUBSTR(REPLACE(x, '-', ''), 1, 4) AS INT64), | |
| CAST(SUBSTR(REPLACE(x, '-', ''), 5, 2) AS INT64), | |
| CAST(SUBSTR(REPLACE(x, '-', ''), 7, 2) AS INT64)) |
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
| function startpg | |
| if test -z (docker ps --filter name=mypostgresql --quiet) | |
| echo "Start PostgreSQL container" | |
| docker run --rm --detach --publish 15432:5432 \ | |
| --name mypostgresql \ | |
| --volume (pwd)/db:/var/lib/postgresql/data \ | |
| postgres | |
| echo -n "Starting PostfreSQL process " | |
| while test -z $PG_READY |
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 flask import Flask, request | |
| from flask_sockets import Sockets | |
| app = Flask(__name__) | |
| sockets = Sockets(app) | |
| @app.route('/') | |
| def hey(): | |
| name = request.args.get('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
| alias unittest="python -m unittest" | |
| function rmpyc | |
| find . -type f -name "*.pyc" -delete | |
| find . -type d -name "__pycache__" -delete | |
| find . -type d -name "*.egg-info" -delete | |
| end | |
| function pipupgrade | |
| set packages (pip list --disable-pip-version-check --format columns\ |
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 logging | |
| logger = logging.getLogger('xxx') | |
| for lvl in (logging.DEBUG, logging.INFO, | |
| logging.WARNING, logging.ERROR, logging.CRITICAL): | |
| logger.setLevel(lvl) | |
| print(logger.level) | |
| logger.debug('debug') |
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.*; | |
| import java.net.*; | |
| public class MyEchoClient { | |
| public static void main(String args[]) { | |
| try { | |
| Socket sock = new Socket("127.0.0.1" , 10007); | |
| InputStream in = sock.getInputStream(); | |
| OutputStream out = sock.getOutputStream(); | |
| String str = "hello\n"; |