Skip to content

Instantly share code, notes, and snippets.

Avatar
🍻
Happy beer!!!! Wow!!!!!!

Collonville Collonville

🍻
Happy beer!!!! Wow!!!!!!
View GitHub Profile
@Collonville
Collonville / resize_padding.py
Created Sep 27, 2019
Resize and 0 padding using tensorflow
View resize_padding.py
tf_image = tf.io.decode_image(image, channels=3)
tf_image = tf.compat.v1.image.resize_image_with_pad(tf_image, 256, 512)
out = tf.cast(tf_image, tf.uint8)
out = tf.image.encode_jpeg(out, format="rgb", quality=100)
# out = tf.io.write_file("test.jpeg", out)
with tf.Session() as sess:
jpeg_byte = sess.run(out)
View FireSharpSimpleTextPost.cs
using FireSharp;
using FireSharp.Config;
using FireSharp.Interfaces;
using FireSharp.Response;
using System;
namespace FireBaseChat
{
class Program
{
View plotCIE1931xy_2.py
import itertools
import numpy as np
import matplotlib.pyplot as plt
import colour
from colour.plotting import *
#RGBを0.0~0.1の間隔で分割し、組み合わせを列挙
line = np.linspace(0.0, 1.0, 15, endpoint=True)
rgb = np.array(list(itertools.product(line,line,line)), dtype=np.float)
View plotCIE1931xy.py
import colour
from colour.plotting import *
from colour.models import *
CIE_1931_chromaticity_diagram_plot(
bounding_box=(-0.1, 0.9, -0.1, 0.9),
standalone=True)
View ItemData.cs
//Revised ver
[System.Serializable]
public class ItemData{
public int id;
public int power;
}
View ServerManager.cs
using System.Collections.Generic;
using UnityEngine;
public class ServerManager : MonoBehaviour {
private Dictionary<int, ClientData> clientList;
[SerializeField]
private GameObject clientPrefab;
// Use this for initialization
View ClientData.cs
using System.Collections.Generic;
using UnityEngine;
[System.Serializable]
public class ClientData : MonoBehaviour {
public int id;
public List<ItemData> itemList;
}
View ItemData.cs
using UnityEngine;
[System.Serializable]
public class ItemData : MonoBehaviour {
public int id;
public int power;
}
View LINQSample4.cs
static void Main(string[] args)
{
List<int> foo = new List<int> { 6, 1, 4, 9, 2 }; //list
var cnt = foo.Select(x => x * 2).Where(x => x <= 14).Count();
Console.WriteLine(cnt); // show count
}
View SortSample.cs
class Program
{
static void Main(string[] args)
{
List<Player> foo = new List<Player>
{
new Player(100, "Miku"),
new Player(350, "Ren"),
new Player(700, "Yukarin"),
new Player(3500, "IA")
You can’t perform that action at this time.