Skip to content

Instantly share code, notes, and snippets.

View xgenvn's full-sized avatar

TuNA xgenvn

View GitHub Profile
@xgenvn
xgenvn / get_date.bat
Last active August 26, 2017 12:53
Get Date from DOS
@echo on
:: GENERATE UNIQUE
for /f "skip=1 tokens=2-4 delims=(-)" %%a in ('"echo.|date"') do (
for /f "tokens=1-3 delims=/.- " %%A in ("%date:* =%") do (
set %%a=%%A&set %%b=%%B&set %%c=%%C))
set /a "yy=10000%yy% %%10000,mm=100%mm% %% 100,dd=100%dd% %% 100"
for /f "tokens=1-4 delims=:. " %%A in ("%time: =0%") do @set UNIQUE=%yy%%mm%%dd%%%A%%B%%C%%D
@xgenvn
xgenvn / ToggleSwitchStyle.xaml
Created September 6, 2017 04:33
ToggleSwitch WPF Customization
<Style TargetType="{x:Type CheckBox}">
<Setter Property="Background" Value="{DynamicResource WhiteBrush}"/>
<Setter Property="BorderBrush" Value="{DynamicResource CheckBoxBrush}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="controls:ControlsHelper.FocusBorderBrush" Value="{DynamicResource HighlightBrush}"/>
<Setter Property="controls:ControlsHelper.MouseOverBorderBrush" Value="{DynamicResource CheckBoxMouseOverBrush}"/>
<Setter Property="FontFamily" Value="{DynamicResource ContentFontFamily}"/>
<Setter Property="FontSize" Value="{DynamicResource ContentFontSize}"/>
<Setter Property="Foreground" Value="{DynamicResource LabelTextBrush}"/>
<Setter Property="HorizontalContentAlignment" Value="Left"/>
@xgenvn
xgenvn / 01_GreetingAspect.cs
Created October 5, 2017 04:11 — forked from manadart/01_GreetingAspect.cs
Example usage of TinyIoC - the first with constructor injection, the second with property injection.
namespace TinyIoCDemo
{
// This is the interface for my aspect - the dependency for my classes.
public interface IAspectDependency
{
string GetGreeting();
}
// And here is an implementation.
public class GreetingAspect : IAspectDependency
#!/bin/bash -e
# ubuntu-docker-install.sh
#
# Quick-usage:
#
# wget https://gist.githubusercontent.com/deanrather/9da36d690bd9b57c33fb3ddeb4321cc7/raw/ubuntu-docker-install.sh -O - | sh
#
# https://docs.docker.com/engine/installation/linux/ubuntulinux/
# https://github.com/docker/compose/releases
#
@xgenvn
xgenvn / css-selectors.md
Created October 18, 2017 01:26 — forked from magicznyleszek/css-selectors.md
CSS Selectors Cheatsheet

CSS Selectors Cheatsheet

Element selectors

Element -- selects all h2 elements on the page

h2 {
    foo: bar;
@xgenvn
xgenvn / aes-example.cs
Created October 19, 2017 15:51 — forked from yetanotherchris/aes-example.cs
C# AES asymmetric encryption and decryption example
string ivAsBase64;
string encryptedTextAsBase64;
string keyAsBase64;
using (AesCryptoServiceProvider aes = new AesCryptoServiceProvider())
{
// Store the IV (they can be stored if you don't re-use a key)
aes.GenerateIV();
byte[] iv = aes.IV;
ivAsBase64 = Convert.ToBase64String(iv);
@xgenvn
xgenvn / darkconemu.xml
Created October 24, 2017 02:06 — forked from JanDeDobbeleer/darkconemu.xml
DarkConEmu.xml
<key name="Palette4" modified="2016-08-07 14:21:13" build="160724">
<value name="Name" type="string" data="DarkConEmu"/>
<value name="ExtendColors" type="hex" data="01"/>
<value name="ExtendColorIdx" type="hex" data="0f"/>
<value name="TextColorIdx" type="hex" data="0f"/>
<value name="BackColorIdx" type="hex" data="0d"/>
<value name="PopTextColorIdx" type="hex" data="0d"/>
<value name="PopBackColorIdx" type="hex" data="0d"/>
<value name="ColorTable00" type="dword" data="001e1e1e"/>
<value name="ColorTable01" type="dword" data="00cc7a00"/>
@xgenvn
xgenvn / DockerRedis_ExportImport_Dump.sh
Created November 1, 2017 17:57 — forked from alister/DockerRedis_ExportImport_Dump.sh
Example of creating a Docker data volume, exporting it, and re-importing it to a completely fresh container
# Create the container - we run 'echo' in the container, and reuse the same as we will be running later
docker run -d -v /data --name redis.data dockerfile/redis echo Data-only container for Redis
# the data container doesn't show up - nothing is running
docker ps
# will show 'redis.data', but as stopped
docker ps -a
# start redis, attach to 'redis.data'
docker run -d -p 6379:6379 --volumes-from redis.data --name ca.redis.1 dockerfile/redis
@xgenvn
xgenvn / README.md
Created November 6, 2017 14:40 — forked from hofmannsven/README.md
My simply Git Cheatsheet
@xgenvn
xgenvn / 0.cli.md
Last active November 15, 2017 03:14
Use UIkit in angular5 cli based project
ng new playground
npm i -s uikit
npm i -s jquery 
npm i -D @types/jquery