Skip to content

Instantly share code, notes, and snippets.

View espresso3389's full-sized avatar

Takashi Kawasaki espresso3389

View GitHub Profile
using System;
using System.IO;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Media.Imaging;
namespace FileThumbnailExtractor
{
@espresso3389
espresso3389 / colorpicker.cpp
Created March 9, 2016 17:10
Easy color picker implementation
#include <stdio.h>
#include <windows.h>
#include <ShellScalingAPI.h>
#pragma comment(lib,"gdi32.lib")
#pragma comment(lib,"user32.lib")
#pragma comment(lib,"shcore.lib")
int main()
@espresso3389
espresso3389 / urlcredtest.mm
Last active June 1, 2016 20:18
Key-chain Access Test (Obj-C++)
#include <stdio.h>
#import <CoreFoundation/CoreFoundation.h>
#import <Foundation/NSURLCredentialStorage.h>
#import <Foundation/NSURLCredential.h>
#import <Foundation/NSURLProtectionSpace.h>
#import <Foundation/NSString.h>
#import <Foundation/NSException.h>
class CredentialStore
@espresso3389
espresso3389 / seckeychain.cxx
Last active June 1, 2016 20:19
Key-chain Access Test (C++)
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <Security/SecKeychain.h>
#include <Security/SecKeychainItem.h>
#include <Security/SecKeychainSearch.h>
#include <Security/SecItem.h>
void setCredential();
@espresso3389
espresso3389 / chromecache.cs
Created June 1, 2016 20:36
Chrome Cache Retriever
using System;
using System.Drawing;
using System.Drawing.Imaging;
using System.Collections.Generic;
using System.IO;
using System.Runtime.InteropServices;
namespace cie
{
public delegate void WriteLineDelegate(string format, params object[] args);
@espresso3389
espresso3389 / BackgroundDispatcher.cs
Created August 8, 2016 08:20
A wrapper code to use GCD with C#'s async/await.
using CoreFoundation;
using System;
using System.Threading;
using System.Threading.Tasks;
namespace BackgroundDispatcher
{
/// <summary>
/// Wrapper for Grand Central Dispatch.
/// </summary>
@espresso3389
espresso3389 / xamform+netstd16.csproj
Created May 30, 2017 21:59
Xamarin.Forms+.NET Standard 1.6
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard1.6</TargetFramework>
<PackageTargetFallback>portable-net45+win8+wpa81+wp8</PackageTargetFallback>
<DebugType>full</DebugType>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Xamarin.Forms" Version="2.3.4.247" />
</ItemGroup>
<ItemGroup>
@espresso3389
espresso3389 / consumer.csproj
Created June 11, 2017 19:07
*.Android/*.iOS csproj require these tags
<CopyNuGetImplementations>true</CopyNuGetImplementations>
<RestoreProjectStyle>PackageReference</RestoreProjectStyle>
@espresso3389
espresso3389 / apkuploader.cs
Created June 24, 2017 19:43
Automatic APK Uploader
// This code is based on the following article but updated for the latest system (June 2017):
// Automatic apk upload to Google Play (part 1)
// http://petr.logdown.com/posts/255755-automatic-apk-upload-1
using System;
using System.Collections.Generic;
using System.IO;
// Google.Apis.AndroidPublisher.v2
using Google.Apis.AndroidPublisher.v2;
using Google.Apis.AndroidPublisher.v2.Data;
@espresso3389
espresso3389 / normal_loop.cpp
Created December 16, 2017 15:04
Random number sequence
int main()
{
std::mt19937 r;
for (;;)
std::printf("%d\n", r());
}