Skip to content

Instantly share code, notes, and snippets.

View fliedonion's full-sized avatar

Takahiro KITAHARA fliedonion

View GitHub Profile
@fliedonion
fliedonion / TaskCompletionSourceBasic.cs
Created September 20, 2016 23:41
TaskCompletionSource example.
class Program {
static Task<byte[]> FromWebClient(WebClient wc, Uri address) {
var tcs = new TaskCompletionSource<byte[]>();
wc.DownloadDataCompleted += (object sender, DownloadDataCompletedEventArgs e) => {
if (e.Cancelled)
tcs.SetCanceled();
else if (e.Error != null)
tcs.SetException(e.Error);
@fliedonion
fliedonion / CheckJavaVersion.cs
Last active July 7, 2017 14:24
Get Java version of specified directory.
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Text.RegularExpressions;
namespace CheckJavaVersion {
class Program {
static void Main(string[] args) {
@fliedonion
fliedonion / FpSpread_InDirectCell.cs
Created December 6, 2016 17:15
FarPoint Spread, "INDIRECTCELL" custom function similar with Excel "INDIRECT".
using System.Windows.Forms;
using FarPoint.CalcEngine;
using FarPoint.Win.Spread.Model;
namespace WindowsFormsApplication1 {
public partial class Form1 : Form {
// this is only behind code.
// put Spread in form designer.
// run and edit A1 cell. values appear in D3, D4 and E3 cells.
@fliedonion
fliedonion / install.md
Last active December 14, 2016 17:28
install bat for gogs with nssm

install gogs with nssm.

summary

usage:
gogs-nssm-installer.bat <your-machine-name> <ip-of-your-machine> <port-for-gogs-web>

ex) gogs-nssm-installer.bat mywin8 192.168.0.10 5050

important notice: If use none secure location, use loopback ip (like 127.0.1.1) for gogs and use gogs behind other web server (nginx, apache etc).

@fliedonion
fliedonion / RxAndThenWhenFizzBuzz.cs
Last active April 7, 2017 02:54
Reactive Extensions And/Then/When FizzBuzz
using System;
using System.Linq;
using System.Reactive.Linq;
namespace RxAndThenWhenFizzBuzz {
class Program {
static void Main(string[] args) {
var numberObserver = Observable.Range(1, 30);
var fizzObserver = numberObserver.Select(i => i % 3 == 0 ? "Fizz" : "");
var buzzObserver = numberObserver.Select(i => i % 5 == 0 ? "Buzz" : "");
@fliedonion
fliedonion / RxZipFizzBuzz.cs
Created April 6, 2017 17:33
Reactive Extensions Zip FizzBuzz
using System;
using System.Linq;
using System.Reactive.Linq;
namespace RxZipFizzBuzz
{
class Program
{
static void Main(string[] args)
{
@fliedonion
fliedonion / SampleForm1.cs
Last active September 4, 2017 23:48
TextRender-Wrap-sample
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
@fliedonion
fliedonion / IconLoader.cs
Last active September 19, 2017 23:51
Load Icon Data From File. Sideline of my other program using UpdateResource.
using System;
using System.Collections.Generic;
using System.IO;
using System.Runtime.InteropServices;
// https://stackoverflow.com/a/36795367
// http://schima.hatenablog.com/entry/20090512/1242139542
// https://blogs.msdn.microsoft.com/oldnewthing/20120720-00/?p=7083
namespace IconLoadToStruct {
// place this file the path such ends with: ChatServer/server/ChatServer.java
package ChatServer.server;
import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.ArrayList;
import java.util.List;
@fliedonion
fliedonion / result_sample.elm
Last active November 7, 2017 04:22
hello-elm
import Html exposing (text, h1)
{-
type alias EmailAddress = String
type alias Message =
{ recipient : EmailAddress
, body : String
}