Skip to content

Instantly share code, notes, and snippets.

umihico

Block or report user

Report or block umihico

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@umihico
umihico / lambda_function.py
Last active Jan 3, 2020
create selenium layer including binary WORKS python 3.7. NOT 3.8
View lambda_function.py
import json
from selenium import webdriver
def lambda_handler(event, context):
chrome=Chrome()
chrome.get('https://www.google.com/')
print(chrome.title)
chrome.quit()
return {
'statusCode': 200,
@umihico
umihico / README.md
Created Jan 2, 2020
get all slack ids in your slack workspace
View README.md

python list_all_slack_id.py xoxp-000000000000-abcdef

output will be like

https://slack.com/api/channels.list?token=xoxp-000000000000-abcdef
https://slack.com/api/usergroups.list?token=xoxp-000000000000-abcdef
https://slack.com/api/users.list?token=xoxp-000000000000-abcdef
{'CB0000000': 'general',
 'CB0000000': 'random',
 'UB0000000': 'umihico',
@umihico
umihico / lambda_function.py
Created Dec 12, 2019
Publish any AWS quicksight dashboards to public with lambda and API gateway
View lambda_function.py
import json
import boto3
"""
API gateway URL example. You have to allow your quicksight domin setting to be accessed from amazonaws.com including subdomains.
https://xxxxxxxx.execute-api.ap-northeast-1.amazonaws.com/xxx-gateway-stage-xxxx/your-lambda-func-name?dashboard_id=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxx
"""
def lambda_handler(event, context):
dashboard_id=event["queryStringParameters"]['dashboard_id']
@umihico
umihico / result.json
Created Oct 6, 2019
Scrap all city names from wikipedia
View result.json
{"A Coru\u00f1a": "Spain", "Aachen": "Germany", "Aalborg": "Denmark", "Aarhus": "Denmark", "Aba, Nigeria": "Nigeria", "Abadan, Iran": "Iran", "Abaetetuba": "Brazil", "Abakan": "Russia", "Abbotabad": "Pakistan", "Abbotsford, British Columbia": "Canada", "Abengourou": "Ivory Coast", "Abeokuta": "Nigeria", "Aberdeen": "United Kingdom", "Abha": "Saudi Arabia", "Abidjan": "Ivory Coast", "Abiko, Chiba": "Japan", "Abilene, Texas": "United States", "Abohar": "India", "Abu Al-Khaseeb": "Iraq", "Abu Dhabi": "United Arab Emirates", "Abu Ghraib": "Iraq", "Abuja": "Nigeria", "A\u00e7ail\u00e2ndia": "Brazil", "Acapulco": "Mexico", "Acarigua": "Venezuela", "Accra": "Ghana", "Achalpur": "India", "Acheng District": "China", "Achinsk": "Russia", "Adama": "Ethiopia", "Adana": "Turkey", "Adapazar\u0131": "Turkey", "Addis Ababa": "Ethiopia", "Adelaide": "Australia", "Aden": "Yemen", "Adhamiyah": "Iraq", "Adilabad": "India", "Adityapur": "India", "Ad\u0131yaman": "Turkey", "Ado-Ekiti": "Nigeria", "Adoni": "India", "Afyon": "Turkey
@umihico
umihico / lambda_function.py
Created Sep 3, 2019
AWS Lambda function to return image
View lambda_function.py
import requests
import base64
def lambda_handler(event, content):
response = requests.get("https://github.com/umihico.png")
return {
"isBase64Encoded": True,
"statusCode": 200,
"headers": { "content-type": "image/jpg"},
"body": base64.b64encode(response.content).decode("utf-8")
}
@umihico
umihico / README.md
Last active Sep 3, 2019
Download Python Pillow package for AWS lambda
View README.md
  1. run docker-compose up.
  2. confirm you get PIL and Pillow-6.1.0.dist-info directory next .yml file.
  3. upload them as AWS Lambda Layer
@umihico
umihico / api.php
Last active Jul 12, 2019
Get CSV as array from input form with ajax in Laravel 5.8.14
View api.php
<?php
use Illuminate\Http\Request;
/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
You can’t perform that action at this time.