Skip to content

Instantly share code, notes, and snippets.

@rosmo
rosmo / c6_test.py
Created January 12, 2022 21:54
TP-Link X90 Deco API example
from requests.api import request
from Crypto.Cipher import PKCS1_OAEP, PKCS1_v1_5
from Crypto.Cipher import AES
from Crypto.PublicKey import RSA
from Crypto.Util.Padding import pad
from Crypto.Util.number import bytes_to_long
import base64
import requests
import string
import random
@RicardoBelchior
RicardoBelchior / svg-to-android.sh
Last active December 8, 2017 21:32 — forked from deepankarb/svg-to-android.sh
A script to generate android assets from a SVG file. Requires inkscape to resize and convert.
#!/bin/bash
USAGE="Usage is: ./svg-to-android.sh <svg_file> <exported_png_name> <width_dp> <height_dp> [resources_dir] \n \
If 'resources_dir' is ommited, a new folder is created in the current directory, named after the svg name.\n \
Param 'exported_png_name' does not need extension.\n \
On Mac OS specify full path for svg file and resources directory.\n \
Exiting."
if [[ -z "$1" ]];
then
@deepankarb
deepankarb / svg-to-android.sh
Last active July 14, 2018 13:13
A script to generate android assets from a SVG file. Requires inkscape to resize and convert.
#!/bin/bash
if [[ -z "$1" ]];
then
echo "No SVG file specified. Exiting."
exit -1
fi
ispng=$(file $1)
echo $ispng | grep -q SVG
@komiya-atsushi
komiya-atsushi / BearerAuthenticateByTwitter4JDemo.java
Created April 13, 2013 06:13
Twitter4J で Application-only authentication の bearer トークンを用いて Twitter API を呼び出す ref: http://qiita.com/items/84d22445fac14dc6cffa
package demo.twitter4j;
import twitter4j.Twitter;
import twitter4j.TwitterException;
import twitter4j.TwitterFactory;
import twitter4j.auth.Authorization;
import twitter4j.conf.ConfigurationBuilder;
import twitter4j.internal.http.HttpRequest;
/**
@JakeWharton
JakeWharton / AspectRatioImageView.java
Created June 2, 2012 02:14
ImageView that respects an aspect ratio applied to a specific measurement.
// Copyright 2012 Square, Inc.
package com.squareup.widgets;
import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.widget.ImageView;
/** Maintains an aspect ratio based on either width or height. Disabled by default. */
public class AspectRatioImageView extends ImageView {