Skip to content

Instantly share code, notes, and snippets.

View download_with_requests.py
import shutil
import requests
def download(url, dst):
response = requests.get(url, stream=True)
with open(str(dst), 'wb') as out_file:
shutil.copyfileobj(response.raw, out_file)
del response
@satomacoto
satomacoto / __README.md
Created Mar 17, 2019
How to add Slack incoming webhook
View __README.md
  1. https://api.slack.com/apps
  2. Create New App
  3. Set App Name and Development Slack Workspace
  4. Tap App to move Building Apps for Slack
  5. Add features and functionality
  6. Select Incoming Webhooks
  7. Add New Webhook to Workspace
View google_langs.js
(function() {
var language_info = {
languages_top: [
{ code: "de", name: "Deutsch" },
{ code: "en", name: "English", checked: true },
{ code: "es", name: "español" },
{ code: "es-419", name: "español (Latinoamérica)" },
{ code: "fr", name: "français" },
{ code: "hr", name: "hrvatski" },
{ code: "it", name: "italiano" },
@satomacoto
satomacoto / setup.sh
Last active Oct 25, 2018
Install node and npm with n
View setup.sh
# install node & npm
apt-get install -y nodejs npm apt-transport-https
npm cache clean
npm install n -g
n stable
ln -sf /usr/local/bin/node /usr/bin/node
ln -sf /usr/local/bin/npm /usr/bin/npm
View colorDict.py
import seaborn as sns
colorDict = {}
palette = "hls"
colorPalette = sns.color_palette(palette, len(allLabels))
for i, label in enumerate(allLabels):
colorDict[label] = colorPalette[i]
View image_np_to_image_string.py
import cv2
from PIL import Image
cap = cv2.VideoCapture(0)
_, img = cap.read()
image_string = cv2.imencode(".png", img)[1].tostring()
output = io.BytesIO()
Image.fromarray(img).save(output, format='PNG')
buf = output.getvalue()
View rm-docker.sh
docker images | awk '/<none/{print $3}' | xargs docker rmi
docker ps -f "status=exited" -q | xargs docker rm
View README.md
curl -fsSL https://gist.githubusercontent.com/satomacoto/b27dc3f871938d2614819bba3c589b45/raw/setup1.sh | bash
curl -fsSL https://gist.githubusercontent.com/satomacoto/b27dc3f871938d2614819bba3c589b45/raw/setup2.sh | bash
View how-to-install-miniconda-with-pyenv-on-fish.sh
pyenv install miniconda3-latest
pyenv local miniconda3-latest
conda create -n myenv anaconda
source (conda info --root)/etc/fish/conf.d/conda.fish
conda activate myenv
View Twitter API with Curl
# create an account, create an app
# @see https://apps.twitter.com/
# retrieve the access tokens
# @see https://dev.twitter.com/oauth/reference/post/oauth2/token
# create the file ~/twitter_api
nano ~/twitter_api
Authorization: OAuth oauth_consumer_key="XXXXXX", oauth_nonce="11111111", oauth_signature="XXXXXX", oauth_signature_method="HMAC-SHA1", oauth_timestamp="1450728725", oauth_token="99999-XXXXXX", oauth_version="1.0"
You can’t perform that action at this time.