Skip to content

Instantly share code, notes, and snippets.

View jorgedison's full-sized avatar
🏠
Working from home

Jorge Rodriguez Flores jorgedison

🏠
Working from home
View GitHub Profile
rem Batch compressing individual files (non recursive)
for %A in (*.png *.txt) do "G:\UTILITIES\7-Zip\7z.exe" a -t7z -m9=LZMA2 "%A.7z" "%A"
rem Batch compressing individual files (recursive)
for /R "L:\My\Folder\" %A in (*.txt *.doc) do "G:\UTILITIES\7-Zip\7z.exe" a -t7z -m9=LZMA2 "%A.7z" "%A"
rem Batch compressing all folders of the current directory
for /D %A in (*) do "G:\UTILITIES\7-Zip\7z.exe" a -t7z -m9=LZMA2 "%A.7z" "%A"
@jorgedison
jorgedison / valida.xml
Created March 17, 2018 09:07
Valida XML
Dim xmlDoc As XmlDocument = New XmlDocument()
xmlDoc.PreserveWhitespace = True
xmlDoc.Load("Path XML.xml")
Dim signedXml As SignedXml = New SignedXml(xmlDoc)
Dim nodeList As XmlNodeList = xmlDoc.GetElementsByTagName("ds:Signature")
If nodeList.Count <> 1 Then
Throw New Exception("Se produjo un error en la firma del documento")
End If
1. Start | Run | Gpedit.msc if editing the local policy or chose the appropriate policy and edit it.
2. Computer Configuration | Windows Settings | Security Settings | Local Policies | User Rights Assignment.
3. Find and double click "Deny logon through Remote Desktop Services"
4. Add the user and / or the group that you would like to dny access.
5. Click ok.
6. Either run gpupdate /force /target:computer or wait for the next policy refresh for this setting to take effect.
@jorgedison
jorgedison / forever.md
Created March 1, 2017 17:16
Forever chkconfig

Install Forever:

npm install forever -g

now your can run forever

forever --help
forever start app.js
@jorgedison
jorgedison / ConsumeSOAP.php
Created February 2, 2017 16:48
Cliente NuSOAP para consumir WSDL
<?php
require_once('lib/nusoap.php');
$wsdl = "https://pagoefectivo.pe/PagoEfectivoWSGeneralv2/service.asmx?WSDL";
$client = new nusoap_client($wsdl, 'wsdl');
// Seguridad
$username = "username";
$password = "pass";
@jorgedison
jorgedison / PostgreSQL9.4.sh
Created January 24, 2017 15:21
Configuration PostgreSQL 9.4
rpm -Uvh https://yum.postgresql.org/9.4/redhat/rhel-6-x86_64/pgdg-centos94-9.4-2.noarch.rpm -y
yum list postgresql94*
yum install postgresql95-server postgresql94 -y
/etc/init.d/postgresql-9.4 initdb
/etc/init.d/postgresql-9.4 start
@jorgedison
jorgedison / TruncateTablesPostgresql.sql
Created January 21, 2017 15:45
Funcion para eliminar datos de tablas de PostgreSQL
CREATE OR REPLACE FUNCTION truncate_tables(username IN VARCHAR) RETURNS void AS $$
DECLARE
statements CURSOR FOR
SELECT tablename FROM pg_tables
WHERE tableowner = username AND schemaname = 'public';
BEGIN
FOR stmt IN statements LOOP
EXECUTE 'TRUNCATE TABLE ' || quote_ident(stmt.tablename) || ' CASCADE;';
END LOOP;
END;
@jorgedison
jorgedison / GUICentos7.sh
Created January 19, 2017 17:00
GUICentos7.sh
yum -y groupinstall "GNOME Desktop"
@jorgedison
jorgedison / Program.cs
Created January 19, 2017 13:47
Program.cs
using System;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
namespace ConsoleApplication
{
public class Program
{
public static void Main(string[] args)
@jorgedison
jorgedison / test.php
Created December 13, 2016 15:55
test
<?php
function getSubString($string, $length=NULL)
{
//Si no se especifica la longitud por defecto es 50
if ($length == NULL)
$length = 65;
//Primero eliminamos las etiquetas html y luego cortamos el string
$stringDisplay = substr(strip_tags($string), 0, $length);
//Si el texto es mayor que la longitud se agrega puntos suspensivos