This file contains 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
public sealed class Base32 { | |
// the valid chars for the encoding | |
private static string ValidChars = "QAZ2WSX3" + "EDC4RFV5" + "TGB6YHN7" + "UJM8K9LP"; | |
/// <summary> | |
/// Converts an array of bytes to a Base32-k string. | |
/// </summary> | |
public static string ToBase32String(byte[] bytes) { |
This file contains 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
cd /home/<user>/ | |
sudo apt-get install unzip | |
wget https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip | |
unzip sdk-tools-linux-4333796.zip -d Android | |
rm sdk-tools-linux-4333796.zip | |
sudo apt-get install -y lib32z1 openjdk-8-jdk | |
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64 | |
export PATH=$PATH:$JAVA_HOME/bin | |
printf "\n\nexport JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64\nexport PATH=\$PATH:\$JAVA_HOME/bin" >> ~/.bashrc | |
cd Android/tools/bin |
This file contains 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
/* | |
This is a combinatorial optimization problem. | |
It's could be see at http://en.wikipedia.org/wiki/Knapsack_problem | |
This demo output the following objects: | |
{ Name = "Book", Weight = 40} | |
{ Name = "Pen", Weight = 50} | |
{ Name = "Chair", Weight = 2} | |
{ Name = "Bike", Weight = 1} | |
{ Name = "Scooter", Weight = 3 } |
This file contains 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
public abstract class ValueObject<T> | |
where T : ValueObject<T> | |
{ | |
public override bool Equals(object obj) | |
{ | |
var valueObject = obj as T; | |
if (ReferenceEquals(valueObject, null)) | |
return false; | |
This file contains 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
// Mais detalhes em https://docs.microsoft.com/pt-br/ef/core/modeling/value-conversions | |
private static readonly JsonSerializerSettings _jsonSettings = new JsonSerializerSettings { NullValueHandling= NullValueHandling.Ignore }; | |
public class UserPermissionConfiguration: IEntityTypeConfiguration<UserPermission> | |
{ | |
public void Configure(EntityTypeBuilder<UserPermission> builder) | |
{ | |
builder.ToTable("UserPermission"); | |
builder.Property(b => b.Panes) |
This file contains 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
//Written by Paul Seal. Licensed under MIT. Free for private and commercial uses. | |
using System; | |
using System.Text.RegularExpressions; | |
using CodeShare.Library.Passwords; | |
public class Program | |
{ | |
public static void Main() | |
{ |
This file contains 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
[user] | |
name = Giovanni Bassi | |
email = giggio@email | |
[diff] | |
indentHeuristic = true | |
submodule = log | |
[color] | |
diff = always | |
interactive = always | |
status = always |
This file contains 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
# 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 | |
This file contains 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
let uploadEngine = new plupload.Uploader({ | |
runtimes: 'html5', | |
url: `${apiUrl}/upload`, | |
multiple_queues: true, | |
multi_selection: true, | |
browse_button: 'btnAddFoto', | |
multipart_params: { | |
'File': '${filename}', | |
}, | |
filters: { |
This file contains 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
class Tz | |
{ | |
/// <summary> | |
/// Maintain date time values from UTC DateTime but change her offset for espefict time zone. | |
/// </summary> | |
/// <param name="localDate">DateTime in UTC</param> | |
/// <param name="timeZoneId">IANA time zone format</param> | |
/// <returns></returns> | |
public static DateTime ShiftUtcDateTimeToTimeZoneOffSet(DateTime localDate, string timeZoneId) | |
{ |