Skip to content

Instantly share code, notes, and snippets.

import requests
import urllib.parse
import json
from datetime import datetime
# Load configuration
with open('config.json', 'r') as f:
config = json.load(f)
# Confluence API endpoint URLs
@mootoh
mootoh / load.kt
Created November 21, 2019 10:15
Load remote image with Coil into Jetpack Compose Image
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
MaterialTheme {
Column {
ItemCell(item = Item("cat 1", "https://thumbs-prod.si-cdn.com/s-rtW1rEAQTIGcmUVNFSSPC4s3I=/800x600/filters:no_upscale()/https://public-media.si-cdn.com/filer/56/4a/564a542d-5c37-4be7-8892-98201ab13180/cat-2083492_1280.jpg"))
ItemCell(item = Item("cat 2", "https://images.pexels.com/photos/104827/cat-pet-animal-domestic-104827.jpeg?auto=compress&cs=tinysrgb&h=750&w=1260"))
}
@mootoh
mootoh / nvc.java
Created February 15, 2017 15:50
UINavigationController-like stacked fragment
package net.mootoh.tabexperiment;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@mootoh
mootoh / docker-compose.yml
Created July 14, 2016 09:31
OS X Docker で Redmine を最速で起動する
redmine-mysql:
restart: always
image: sameersbn/mysql:latest
environment:
- DB_USER=redmine
- DB_PASS=password
- DB_NAME=redmine_production
volumes:
- /tmp/docker/redmine/mysql:/var/lib/mysql
@mootoh
mootoh / 0001-Shift-E-to-edit-in-Page.patch
Created March 15, 2016 22:25
crowi shortcut key to edit page
From cafa54547e4043b6bab3e9becba0fb1215cdd9db Mon Sep 17 00:00:00 2001
From: Motohiro Takayama <[email protected]>
Date: Tue, 15 Mar 2016 15:24:11 -0700
Subject: [PATCH] Shift+E to edit in Page
---
lib/views/page.html | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/lib/views/page.html b/lib/views/page.html
@mootoh
mootoh / Zundoko.java
Created March 11, 2016 08:34
Zundoko.rxjava
// https://twitter.com/kumiromilk/status/707437861881180160
public class Zundoko {
private static final String TAG = "KIYOSHI";
private static final String ZUN = "ズン";
private static final String DOKO = "ドコ";
public static void zundoko() {
Observable o = Observable.create(new Observable.OnSubscribe<String>() {
Random rand = new Random();
@mootoh
mootoh / Test1.java
Last active February 19, 2016 09:01
public class ApplicationTest extends ApplicationTestCase<Application> {
private static final String TAG = "Test";
public ApplicationTest() {
super(Application.class);
}
public void testRxSample() throws InterruptedException {
final CountDownLatch signal = new CountDownLatch(1);
final String[] last = new String[1];
@mootoh
mootoh / Camera5XActivity.java
Created February 2, 2016 08:36
Nexus 5X-Rotation-wise camera shooting/saving sample
package com.example.mootoh.camera1sample;
import android.app.Activity;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Matrix;
import android.hardware.Camera;
import android.os.Bundle;
import android.util.Log;
import android.view.Surface;
'use strict';
let fs = require('fs')
, request = require('request')
;
let config = JSON.parse(fs.readFileSync('./config.json'));
let access_token = config.access_token;
let folder = config.folder;
'use strict';
let fs = require('fs')
, request = require('request')
;
let config = JSON.parse(fs.readFileSync('./config.json'));
console.log(config.access_token);
request.post({