Skip to content

Instantly share code, notes, and snippets.

View xgenvn's full-sized avatar

TuNA xgenvn

View GitHub Profile
@xgenvn
xgenvn / WPF_Binding.md
Last active March 15, 2019 08:53
50 shades of binding XAML/WPF

Binding elementName

Binding Path=<Prop>, ElementName=<>

Binding relative source ancestor

<Binding>
  <Binding.RelativeSource>
 
@xgenvn
xgenvn / 101-rx-samples.md
Created January 17, 2019 07:52 — forked from omnibs/101-rx-samples.md
101 Rx Samples in C#

101 Rx Samples in C#

This was taken from http://rxwiki.wikidot.com/101samples, because I wanted to be able to read it more comfortable with syntax highlighting.

Here's the unedited original, translated to Github Markdown glory:

101 Rx Samples - a work in progress

@xgenvn
xgenvn / csharp_array_conversion.cs
Created January 15, 2019 05:48
C# Array 1D-2D conversion
private static T[,] Make2DArray<T>(T[] input, int height, int width)
{
T[,] output = new T[height, width];
for (int i = 0; i < height; i++)
{
for (int j = 0; j < width; j++)
{
output[i, j] = input[i * width + j];
@xgenvn
xgenvn / auth.js
Created January 7, 2019 06:37 — forked from solisoft/auth.js
Authentification endpoint
'use strict';
const db = require('@arangodb').db;
const joi = require('joi');
const createRouter = require('@arangodb/foxx/router');
const sessionsMiddleware = require('@arangodb/foxx/sessions');
const jwtStorage = require('@arangodb/foxx/sessions/storages/jwt');
const createAuth = require('@arangodb/foxx/auth');
const auth = createAuth();
const router = createRouter();
@xgenvn
xgenvn / example_minio_boto3.py
Created December 25, 2018 03:41 — forked from heitorlessa/example_minio_boto3.py
Minio with python boto3
# Sample as to how to initialize s3 client to work with Minio API compatible - https://github.com/minio/minio
# AWS CLI counterpart - https://docs.minio.io/docs/aws-cli-with-minio
import boto3
s3 = boto3.resource('s3',
endpoint_url='http://<minio_IP>:9000',
config=boto3.session.Config(signature_version='s3v4')
)
@xgenvn
xgenvn / Nginx-minio-static.md
Created December 10, 2018 05:48 — forked from harshavardhana/nginx-minio-static.md
How to configure nginx+minio static website?

Ubuntu 16.04

  1. Install nginx
  2. Install minio
  3. Install mc client
  4. Create a bucket:
$ mc mb myminio/static
Bucket created successfully ‘myminio/static’.
@xgenvn
xgenvn / all.html
Last active November 19, 2018 09:13
Chinese_Vietnamese_LocationName
<table>
<tbody>
<tr>
<td>STT</td>
<td>Tiếng Việt</td>
<td>Tiếng Trung</td>
<td>Phiên âm</td>
</tr>
<tr>
<td>1</td>
@xgenvn
xgenvn / Debouncer.cs
Created August 14, 2018 07:34 — forked from pmunin/Debouncer.cs
Action Debouncer for C#
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.ComponentModel;
using System.Timers;
namespace DebounceUtils
{
/// <summary>
/// Event debouncer helps to prevent calling the same event handler too often (like mark Dirty or Invalidate)
@xgenvn
xgenvn / mysql-docker.sh
Last active August 9, 2018 17:58 — forked from spalladino/mysql-docker.sh
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@xgenvn
xgenvn / win7_x86_guide.md
Last active July 10, 2018 13:34
How to GHOST to VMWare
  1. HOST: Select Windows 7 when creating new VM.

Same as xp_x86, but Using SCSI for every driver.