Skip to content

Instantly share code, notes, and snippets.

/*
How use in View?
<PasswordBox>
<i:Interaction.Behaviors>
<local:PasswordBoxBindingBehavior Password="{Binding Password}"/>
</i:Interaction.Behaviors>
</PasswordBox>
How access to orginal string?
@superjamie
superjamie / raspberry-pi-vpn-router.md
Last active April 13, 2024 12:22
Raspberry Pi VPN Router

Raspberry Pi VPN Router

This is a quick-and-dirty guide to setting up a Raspberry Pi as a "router on a stick" to PrivateInternetAccess VPN.

Requirements

Install Raspbian Jessie (2016-05-27-raspbian-jessie.img) to your Pi's sdcard.

Use the Raspberry Pi Configuration tool or sudo raspi-config to:

@golodmor
golodmor / alphacoders.py
Last active June 1, 2020 09:56 — forked from devpruthvi/alphacoders.py
A python script to download all images returned by a search from wall.alphacoders.com. Pics name by tag now
### A program to download wallpapers from alphacoders.com
###Author: N.V.Pruthvi Raj, Anantapur, India.
###Date: 23/12/2014
###Modified on 1/11/2015 according to the new thumbnail system by the site
### Modified for naming pics by tag
import requests,urllib2
import shutil
import re
import os
@alirobe
alirobe / reclaimWindows10.ps1
Last active June 7, 2024 16:24
This Windows 10 Setup Script turns off a bunch of unnecessary Windows 10 telemetery, bloatware, & privacy things. Not guaranteed to catch everything. Review and tweak before running. Reboot after running. Scripts for reversing are included and commented. Fork of https://github.com/Disassembler0/Win10-Initial-Setup-Script (different defaults). N.…
###
###
### UPDATE: For Win 11, I recommend using this tool in place of this script:
### https://christitus.com/windows-tool/
### https://github.com/ChrisTitusTech/winutil
### https://www.youtube.com/watch?v=6UQZ5oQg8XA
### iwr -useb https://christitus.com/win | iex
###
###
@cecilemuller
cecilemuller / letsencrypt_2020.md
Last active April 15, 2024 02:19
How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SSL rating)

How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SLL rating)


Virtual hosts

Let's say you want to host domains first.com and second.com.

Create folders for their files:

@IntergalacticApps
IntergalacticApps / make_windows10_great_again.bat
Last active December 28, 2023 08:16
Make Windows 10 Great Again - stop Windows 10 spying!
@echo off
setlocal EnableDelayedExpansion
ver | find "10." > nul
if errorlevel 1 (
echo Your Windows version is not Windows 10... yet. Brace yourself, Windows 10 is coming^^!
pause
exit
)
@umidjons
umidjons / youtube-dl-download-audio-only-on-best-quality.md
Last active March 9, 2024 07:54
Download Audio from YouTube with youtube-dl

Download Audio from YouTube

-i - ignore errors

-c - continue

-t - use video title as file name

--extract-audio - extract audio track

@ironicbadger
ironicbadger / bash_aliases
Last active June 1, 2024 17:21
Lets Encrypt Reverse Proxy Files
alias dcp='docker-compose -f /opt/docker-compose.yml '
alias dcpull='docker-compose -f /opt/docker-compose.yml pull --parallel'
alias dcplogs='docker-compose -f /opt/docker-compose.yml logs -tf --tail="50" '
alias df='df -h -x aufs -x tmpfs -x udev'
alias editle='sudo vi /opt/appdata/letsencrypt/nginx/site-confs/default'
@shr00mie
shr00mie / letsencrypt_esxi.sh
Last active November 26, 2023 18:12
Let's Encrypt SSL for ESXi
#!/bin/bash
#
## -----------------------------=[ WARNING ]=-------------------------------- ##
#
# This script is now woefully out of date due to which accounts ESXi allows to
# ssh into the box as well as sticky folders/file flags.
# I've since ported the whole thing to python with a lot of bells and whistles
# and if i get around to making it public, i'll put a link here.
#
## -------------------------------=[ Info ]=--------------------------------- ##

The Problem

Say you have a form, into which the user inputs data. You want to have an 'age' field, which is bound to a property in your ViewModel. That 'age' field should be a TextBox. You want to be able to display a nice validation message if the user inputs something which isn't a number here, and you also want to check that if they did input a number, that number is > 0.

Your first instinct is probably to have a public int Age { get; set; } property in your ViewModel, and bind the TextBox to this. However, this is a bit painful - if the user enters something which isn't a number into the TextBox, the assignment to the property will fail (you'll get errors in the Output window), but your ViewModel won't know that this assignment failed, so it can't display a nice "Not a valid number message".

Another approach is to make the property nullable - public int? Age { get; set; }, and introduce a converter which converts invalid values to null. This lets the ViewModel know that something went