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
| SELECT | |
| pos, | |
| sim, | |
| p.* | |
| FROM | |
| produtos AS p, | |
| NULLIF(POSITION('seme' IN LOWER(COALESCE(p.gtin, '') || ' ' || COALESCE(p.descricao, ''))), 0) AS pos, | |
| NULLIF(SIMILARITY(LOWER(COALESCE(p.gtin, '') || ' ' || COALESCE(p.descricao, '')), 'seme'), 0) AS sim | |
| WHERE | |
| (LOWER(COALESCE(p.gtin, '') || ' ' || COALESCE(p.descricao, ''))) LIKE 'seme%' |
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
| private static void ParallelFor() | |
| { | |
| var numberOfIterations = 1000; | |
| var min = 0; | |
| var max = 100_000_000; | |
| var random = new Random(); | |
| var breakIndex = random.Next(1, numberOfIterations); |
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.Linq.Expressions; | |
| using System.Reflection; | |
| namespace CodeZone.EntityFramework.Extensions | |
| { | |
| public static class EFLazyLoadingExtensions | |
| { | |
| public static void Load<TEntity, TRelated>(this TEntity entity, Expression<Func<TEntity, TRelated>> relatedSelector) | |
| where TRelated : class |
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
| import os | |
| // Example of C interop for a very handy task. | |
| // | |
| // wkhtmltopdf and wkhtmltoimage are open source (LGPLv3) command line tools to | |
| // render HTML into PDF and various image formats using the Qt WebKit rendering | |
| // engine. These run entirely "headless" and do not require a display or display | |
| // service. | |
| // | |
| // https://github.com/wkhtmltopdf/wkhtmltopdf |
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.Collections.Generic; | |
| using System.IO; | |
| using System.Runtime.InteropServices; | |
| namespace pinvoke_wkhtmltox | |
| { | |
| class Program | |
| { | |
| static void Main(string[] args) |
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
| import sys | |
| import ctypes | |
| class wkhtmltopdf_global_settings(ctypes.Structure): | |
| _fields_ = [] | |
| class wkhtmltopdf_object_settings(ctypes.Structure): | |
| _fields_ = [] | |
| class wkhtmltopdf_converter(ctypes.Structure): |
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
| function parseDate(sdatetime) { | |
| let dateTime = sdatetime.split(' '); | |
| let sdate = dateTime[0]; | |
| let date = sdate.split('/'); | |
| let stime = dateTime[1]; | |
| let time = stime.split(':'); | |
| return new Date(Date.UTC(date[2], date[1]-1, date[0], time[0], time[1], time[2], 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
| param ( | |
| [string] $NamePattern = "Dummy-web-app-*", | |
| [string] $Status = "Running" | |
| ) | |
| function Get-InstanceStatus () { | |
| $res = $(aws ec2 describe-instances --region us-east-1 --filters "Name=tag:Name,Values=$NamePattern") | |
| $json = $res | ConvertFrom-Json | |
| $instances = $json.Reservations.Instances ` | |
| | Where-Object { $_.State.Name -eq $Status } ` |
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
| param ( | |
| [string] $NamePattern = "Dummy-web-app-*", | |
| [int] $Iterations = 2 | |
| ) | |
| function Get-WebInstances () { | |
| $res = $(aws ec2 describe-instances --region us-east-1 --filters "Name=tag:Name,Values=$NamePattern") | |
| $json = $res | ConvertFrom-Json | |
| $instances = $json.Reservations.Instances ` | |
| | Where-Object { $_.State.Name -eq "Running" } ` |
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
| ################################# | |
| # SENDING LOG TO ELASTIC SEARCH # | |
| ################################# | |
| Import-Module ($PSScriptRoot + "\mod_eslog.psm1") -Force | |
| Send-InstallationLog -Version $remoteVersion | |
| "Current version has been installed." | |
NewerOlder