Skip to content

Instantly share code, notes, and snippets.

View juan-fdz-hawa's full-sized avatar
🏠
Working from home

Juan Fernandez juan-fdz-hawa

🏠
Working from home
  • Self-employed
  • Dominican Republic
View GitHub Profile
Importing data:
---------------
readr (flat files)
exell (excel files)
haven (foreign data formats)
Data processing
---------------
tydyr
dplyr
'//Name : AttachDSNLessTable
'//Purpose : Create a linked table to SQL Server without using a DSN
'//Parameters
'// stLocalTableName: Name of the table that you are creating in the current database
'// stRemoteTableName: Name of the table that you are linking to on the SQL Server database
'// stServer: Name of the SQL Server that you are linking to
'// stDatabase: Name of the SQL Server database that you are linking to
'// stUsername: Name of the SQL Server user who can connect to SQL Server, leave blank to use a Trusted Connection
'// stPassword: SQL Server user password
# Diagnostic plots
diagPlots <- function(model){
p1 <- ggplot(model, aes(.fitted, .resid)) +
geom_point() +
stat_smooth(method = "loess") +
geom_hline(yintercept = 0, col="red", linetype = "dashed") +
xlab("Fitted values") +
ylab("Residuals") +
ggtitle("Residual vs Fitted Plot") +
theme_bw()
{
$match: {
createdAt: {
$gte: fromDate.toISOString()
}
}
},
{
"$project" :
SELECT
geometry::UnionAggregate (Boundaries).STEnvelope().STPointN(1).STX as xmin,
geometry::UnionAggregate (Boundaries).STEnvelope().STPointN(3).STX as xmax,
geometry::UnionAggregate (Boundaries).STEnvelope().STPointN(1).STY as ymin,
geometry::UnionAggregate (Boundaries).STEnvelope().STPointN(3).STY as ymax
FROM [GIS].[BOUNDARIES].[PoliceTownsAndVillages]
SELECT
ROW_NUMBER() OVER (Order by (select 0)) AS RowNumber,
(CASE WHEN CONVERT(INT, (ROW_NUMBER() OVER (ORDER BY (SELECT 0)) % 16)) = 0 THEN 0 ELSE 1 END) + CONVERT(INT, (ROW_NUMBER() OVER (ORDER BY (SELECT 0)) / 16)) as PageGroup,
(CASE WHEN CONVERT(INT, (ROW_NUMBER() OVER (ORDER BY (SELECT 0)) % 8)) = 0 THEN 0 ELSE 1 END) + CONVERT(INT, (ROW_NUMBER() OVER (ORDER BY (SELECT 0)) / 8)) as RowGroup,
*
FROM <<TABLE>>
USE [ReportServer];
GO
SELECT USR.UserName AS SubscriptionOwner
,SUB.ModifiedDate
,SUB.[Description]
,SUB.EventType
,SUB.DeliveryExtension
,SUB.LastStatus
,SUB.LastRunTime
SELECT
DB_NAME(dbid) as DBName,
COUNT(dbid) as NumberOfConnections,
loginame as LoginName
FROM
sys.sysprocesses
WHERE
dbid > 0
GROUP BY
dbid, loginame
$site = Get-SPSite http://urltofreakinlockedsite/
$site.GetType().GetProperty(“MaintenanceMode”).GetSetMethod($true).Invoke($site, @($false))
SELECT name, default_version, installed_version, left(comment,30) As comment
FROM pg_available_extensions
WHERE installed_version IS NOT NULL
ORDER BY name;