Skip to content

Instantly share code, notes, and snippets.

View Luis-Palacios's full-sized avatar
🎯
Focusing

Luis Palacios Luis-Palacios

🎯
Focusing
View GitHub Profile
docker run --name local-postgresql -p 5432:5432 -e POSTGRES_PASSWORD=somePassword -d postgres
psql -h localhost -p 5432 dbName -U dbUser -f dumo.sql
@Luis-Palacios
Luis-Palacios / Docker utils
Created December 18, 2020 02:32
docker-utils.bash
# copy bak file to sql container
docker cp /path/to/db.bak {container_id}://var/opt/mssql/data
@Luis-Palacios
Luis-Palacios / _LayoutTemplate.cshtml
Created November 10, 2018 04:37
Example for creating your own templates for webpackhtmlplugin
@{
/* Modify the _LayoutTemplate.cshtml, the _Layout.cshtml will be generated by webpack */
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>TechNews</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
@Luis-Palacios
Luis-Palacios / restore.ps1
Last active July 21, 2017 21:58
For the Restore multiple database post
$databaseDirectory = "C:\dbbackups\"
Restore-DbaDatabase -SqlInstance localhost -Path ("{0}{1}" -f $databaseDirectory, "database1.bak")
Restore-DbaDatabase -SqlInstance localhost -Path ("{0}{1}" -f $databaseDirectory, "database2.bak")
Restore-DbaDatabase -SqlInstance localhost -Path ("{0}{1}" -f $databaseDirectory, "database3.bak")
@Luis-Palacios
Luis-Palacios / dependencies
Created March 5, 2017 02:51
PHP Dependencies
http://askubuntu.com/questions/756181/installing-php-5-6-on-xenial-16-04
apt-get install php5.6-pgsql
install composer
composer install
@Luis-Palacios
Luis-Palacios / Controller.cs
Created May 11, 2016 20:47
Created Method for ASP.Net Web api
return CreatedAtRoute("DefaultApi", new { id = test.TestId }, test);
string url = Url.Link("DefaultApi", new { id = test.TestId });
return Created(url, test);
//For Route Attirbutes
[Route("api/books/{id}", Name="GetBookById")]
public BookDto GetBook(int id)
{
// Implementation not shown...
@Luis-Palacios
Luis-Palacios / back.bash
Last active April 18, 2016 17:38
Backing up data from a server
tar -zcvf media.tar.gz media/
as root user
pg_dump -h localhost -U Dbuser DbName > /path/fileName.sql
from psqlconsle
\i E:/file.sql
GRANT SELECT ON ALL TABLES IN SCHEMA public TO myuser;
@Luis-Palacios
Luis-Palacios / PropertyStub.snippet
Last active December 29, 2015 00:01
PropertyStub snippet for C# that uses fullprop snippet to implement interface properties
<?xml version="1.0" encoding="utf-8"?>
<!-- Credits go to: http://codeimpossible.com/2010/11/29/Make-Implement-Interface-use-auto-properties/ -->
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Title>Property Stub</Title>
<Description>Snippet for generating property stub</Description>
<Author>Microsoft Corporation</Author>
<SnippetTypes>
<SnippetType>Refactoring</SnippetType>
@Luis-Palacios
Luis-Palacios / regex.js
Created December 10, 2015 14:21
Regex Url Validator (Escaped)
/(((https?:\/\/+)(?:www\.)[A-Za-z0-9.-]+\.+.{2,4}|(?:^www\.)[A-Za-z0-9.-]+\.+.{2,4})((?:\/[\+~%\/.\w-_]*)?(\?+(?:[-\+=&;%@.\w_]*))?(#+(?:[\w]*))?)?)$/