Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
CHATID="1234"
KEY="abcd"
TIME="10"
URL="https://api.telegram.org/bot$KEY/sendMessage"
TEXT="Hello world"
curl -s --max-time $TIME -d "chat_id=$CHATID&disable_web_page_preview=1&text=$TEXT" $URL >/dev/null
@sanggiChoi
sanggiChoi / cognito-developer-authenticated-client-example.py
Created March 24, 2016 05:50 — forked from dkarchmer/cognito-developer-authenticated-client-example.py
django-boto3-cognito: AWS' Cognito Developer Authenticated Identities Authflow using Django/Python/Boto3
__author__ = 'dkarchmer'
'''
Main fucntionality to manage API calls to ampervue.com
'''
import json
import requests
import logging
import boto3
from boto3.session import Session
@sanggiChoi
sanggiChoi / s3-curl-backups.md
Created February 25, 2016 02:11 — forked from jareware/s3-curl-backups.md
Simple, semi-anonymous backups with S3 and curl

⇐ back to the gist-blog at jrw.fi

Simple, semi-anonymous backups with S3 and curl

Backing stuff up is a bit of a hassle, to set up and to maintain. While full-blown backup suites such as duplicity or CrashPlan will do all kinds of clever things for you (and I'd recommend either for more complex setups), sometimes you just want to put that daily database dump somewhere off-site and be done with it. This is what I've done, with an Amazon S3 bucket and curl. Hold onto your hats, there's some Bucket Policy acrobatics ahead.

There's also a tl;dr at the very end if you just want the delicious copy-pasta.

Bucket setup

#!~/usr/bin/env python
# -*- coding: utf-8 -*-
import datetime
import boto.ses.connection
import boto.ec2.cloudwatch
import re
# AWS APIを利用するためのパラメータ。
# 本番ではIAMロールを利用するすること
# First verify the version of Java being used is not SunJSK.
java -version
# Get the latest Sun Java SDK from Oracle http://www.oracle.com/technetwork/java/javase/downloads/jdk-7u1-download-513651.html
wget http://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-linux-i586.rpm
# Rename the file downloaded, just to be nice
mv jdk-7u1-linux-i586.rpm\?e\=1320265424\&h\=916f87354faed15fe652d9f76d64c844 jdk-7u1-linux-i586.rpm
# Install Java