This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --modified from SO: http://stackoverflow.com/questions/5873170/generate-class-from-database-table | |
| --added table and column | |
| declare @TableName sysname = 'TableName' | |
| declare @Result varchar(max) = '[Table(Name = "' + @TableName + '")] | |
| public class ' + @TableName + ' | |
| {' | |
| select @Result = @Result + ' | |
| [Column(DbType = "' + |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using System.IO; | |
| using System.IO.Compression; | |
| using System.Text; | |
| namespace TarExample | |
| { | |
| public class Tar | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| sudo apt install \ | |
| build-essential \ | |
| libpcre3-dev \ | |
| libssl-dev \ | |
| zlib1g-dev \ | |
| libxml2-dev \ | |
| libxslt1-dev \ | |
| libgd-dev \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [{"name":"Israel","dial_code":"+972","code":"IL"},{"name":"Afghanistan","dial_code":"+93","code":"AF"},{"name":"Albania","dial_code":"+355","code":"AL"},{"name":"Algeria","dial_code":"+213","code":"DZ"},{"name":"AmericanSamoa","dial_code":"+1 684","code":"AS"},{"name":"Andorra","dial_code":"+376","code":"AD"},{"name":"Angola","dial_code":"+244","code":"AO"},{"name":"Anguilla","dial_code":"+1 264","code":"AI"},{"name":"Antigua and Barbuda","dial_code":"+1268","code":"AG"},{"name":"Argentina","dial_code":"+54","code":"AR"},{"name":"Armenia","dial_code":"+374","code":"AM"},{"name":"Aruba","dial_code":"+297","code":"AW"},{"name":"Australia","dial_code":"+61","code":"AU"},{"name":"Austria","dial_code":"+43","code":"AT"},{"name":"Azerbaijan","dial_code":"+994","code":"AZ"},{"name":"Bahamas","dial_code":"+1 242","code":"BS"},{"name":"Bahrain","dial_code":"+973","code":"BH"},{"name":"Bangladesh","dial_code":"+880","code":"BD"},{"name":"Barbados","dial_code":"+1 246","code":"BB"},{"name":"Belarus","dial_code":"+375"," |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var countries = { | |
| AF: 'Afghanistan', | |
| AX: 'Aland Islands', | |
| AL: 'Albania', | |
| DZ: 'Algeria', | |
| AS: 'American Samoa', | |
| AD: 'Andorra', | |
| AO: 'Angola', | |
| AI: 'Anguilla', | |
| AQ: 'Antarctica', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| export EXPOSED_PORT=25565 | |
| export BACKEND_HOST=10.10.10.10:25565 | |
| cat <<END | sudo tee /etc/sysctl.d/55-enable-ip-forward.conf | |
| # `/sbin/sysctl net.ipv4.ip_forward` | |
| net.ipv4.ip_forward = 1 | |
| END | |
| sudo sysctl -p /etc/sysctl.d/55-enable-ip-forward.conf |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| *raw | |
| :PREROUTING ACCEPT [0:0] | |
| :OUTPUT ACCEPT [0:0] | |
| -A PREROUTING -p tcp -m tcp --dport 25565 -j CT --notrack | |
| COMMIT | |
| *mangle | |
| :PREROUTING ACCEPT [0:0] | |
| :INPUT ACCEPT [0:0] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| # size of swapfile in megabytes | |
| swapsize=1024 | |
| # does the swap file already exist? | |
| grep -q "swapfile" /etc/fstab | |
| # if not then create it | |
| if [ $? -ne 0 ]; then |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // JS array equivalents to C# LINQ methods - by Dan B. | |
| // Here's a simple array of "person" objects | |
| var people = [ | |
| { name: "John", age: 20 }, | |
| { name: "Mary", age: 35 }, | |
| { name: "Arthur", age: 78 }, | |
| { name: "Mike", age: 27 }, | |
| { name: "Judy", age: 42 }, | |
| { name: "Tim", age: 8 } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [HttpPost] | |
| public HttpResponseMessage CreateCustomer(string name, string billingInfo) | |
| { | |
| Result<BillingInfo> billingInfoResult = BillingInfo.Create(billingInfo); | |
| Result<CustomerName> customerNameResult = CustomerName.Create(name); | |
| return Result.Combine(billingInfoResult, customerNameResult) | |
| .OnSuccess(() => _paymentGateway.ChargeCommission(billingInfoResult.Value)) | |
| .OnSuccess(() => new Customer(customerNameResult.Value)) | |
| .OnSuccess( |
NewerOlder