working on it ...

Filters

Explore Public Snippets

Sort by

Found 315 snippets

    public by DinhoPutz modified Oct 5, 2017  126  1  4  1

    Compactar Arquivos para Backup com Winrar

    REM Compactar arquivos para fazer backup. 
    REM Obs, é recomendável que os caminhos dos arquivos não contenham espaço. 
    
    
    REM Sobre a linha de comando 
    REM "RAR.exe a": o comando "a" adiciona arquivos no arquivo compacto que esta sendo criado.
    REM "-m5": nível de compressão, que vai de 0 à 5, sendo 5 o nível máximo de compressão.
    REM "-r": Para adicionar pastas e subpastas. 
    REM "-ag": É a marca de tempo, recomendável se for criar backups diário. 
    REM ">>": Gera o arquivo de log e a medida que o backup for sendo executado vai adicionandos novas linhas ao mesmo.
    
    C:\progra~2\WinRAR\Rar.exe a -m5 -r -ag_yyyy-MM-dd E:\Arquivo1.rar D:\Pasta1\ >> Saida.txt
    C:\progra~2\WinRAR\Rar.exe a -m5 -r -ag_yyyy-MM-dd E:\Arquivo2.rar D:\Pasta2\ >> Saida.txt
    C:\progra~2\WinRAR\Rar.exe a -m5 -r -ag_yyyy-MM-dd E:\Arquivo3.rar C:\Pasta3\ >> Saida.txt						

    public by RexPhillips modified Jul 24, 2017  103  0  3  0

    RenameFilesInDirectoryWildcard

    Powershell snippet to rename files in a directory in a batch mode.
    dir | rename-item -NewName {$_.name -replace "DEV","PROD"}

    public by maholtz modified Aug 17, 2016  1380  1  4  0

    Windows Batch - for loop

    REM use %%x in Batch file, %x on console
    REM for /l %%x in (START, STEP, END) do (
    for /l %%x in (101, 1, 199) do (
      REM %%x - a longer variable is not allowed?
    	echo Number %%x
    )
    

    public by cghersi modified Apr 13, 2016  2353  0  5  0

    Transform a JKS keystore in a PEM certificate

    This set of commands transform the certificate from a JKS to a PEM format. It requires JDK keytool and openssl.
    keytool -keystore client.ts -exportcert -alias mobile | openssl x509 -inform der -text
    
    #psw of keystore: changeit
    
    keytool -importkeystore -srckeystore client.ts -destkeystore client.p12 -srcstoretype jks -deststoretype pkcs12
    
    #psw of destination keystore: changeit
    
    openssl pkcs12 -in client.p12 -out client.pem
    
    #import psw: changeit

    public by cghersi modified Apr 1, 2016  2364  0  4  0

    Start Eclipse with a non-default JVM

    Eclipse starts with a JMV that is usually the one in the PATH. E.g. the version retrieved thru java --version
    C:\eclipse\eclipse.exe -vm "C:\Program Files\Java\jdk1.6.0_45\bin\javaw.exe"           

    public by cghersi modified Mar 29, 2016  2582  2  7  1

    Enable HTTPS on Tomcat

    How to make the apps running on Tomcat able to publish over https
    // 1. Export certificate request with keytool
    // 1.1 Generate the keytool command with the form at this URL: https://www.digicert.com/easy-csr/keytool.htm
    // 1.2 The result will be a pair of file mydomain.jks and mydomain.csr
    
    // 2. Ask the certificate to the cert authority
    // 2.1 The result will be a pair of file mydomain.pem and mydomain.p7b
    
    // 3. Import mydomain.pem into mydomain.jks (assuming your alias is "server")
    keytool -import -v -trustcacerts -alias server -file mydomain.pem -keystore iot_bissell_com.jks -storepass <secret_psw>
    
    // 4. Edit conf/server.xml in the deployment of Tomcat, add this line 
    // (under the element <Service name="Catalina">):
    <Connector SSLEnabled="true" 
     ciphers="TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA,TLS_RSA_WITH_AES_128_CBC_SHA256,TLS_RSA_WITH_AES_128_CBC_SHA,TLS_RSA_WITH_AES_256_CBC_SHA256,TLS_RSA_WITH_AES_256_CBC_SHA"
     clientAuth="false" keyAlias="server" 
     keystoreFile="/usr/local/tomcat/conf/mydomain.jks" 
     keystorePass="<secret_psw>" maxThreads="150" port="8080" 
     protocol="HTTP/1.1" scheme="https" secure="true" sslProtocol="TLS"/>            

    public by maholtz modified Oct 20, 2015  2536  1  6  0

    while loop batch

    # In einer Zeile, zählt hoch und wartet dazwischen 10 Sekunden
    # Kann als Basis genommen werden um auf die Schnelle Befehle
    # mit Pause in der Shell zu wiederholen
    a=0; while [ "$a" -lt 100 ]; do echo -n "$a"; sleep 10;  a=`expr $a + 1`; done;

    public by cghersi modified Sep 4, 2015  1777  1  6  2

    Sign a DLL with a strong name

    In some cases a DLL with strong name is required. If you need a third party library but this is not signed, the only way to avoid this problem is to deassembly and reassembly the DLL. Note: this can cause problems in licensing, so be sure that you are not infringing any license agreement!
    rem from a Developer Command Prompt, 
    rem go in the bin folder of your project, where is the dependent library (not signed).
    rem Assume your project depends on Foo, third party library not signed.
    
    rem 1) Optional, if Foo depends on Foo2, sign all the other dependencies like Foo2:
    ildasm /all /out=Foo2.il Foo2.dll
    ilasm /dll /key=Key.snk Foo2.il 
    
    rem 2) disassembly
    ildasm /all /out=Foo.il Foo.dll
    
    rem 3) Optional, if Foo depends on Foo2, add the new public token to Foo.il
    rem 3.1) Retrieve the public token (e.g. the result of this step will be publictoken=(6B 75 A8 06 B8 60 95 CD )
    sn -Tp Foo2.dll
    
    rem 3.2) Edit Foo.il file, changing
    rem .assembly extern /*23000005*/ Foo2
    rem {
    rem  .ver 2:1:12:0
    rem }
    rem
    rem  to
    rem
    rem .assembly extern /*23000005*/ Foo2
    rem {
    rem  .publickeytoken = (6B 75 A8 06 B8 60 95 CD )                     
    rem  .ver 2:1:12:0
    rem }
    
    rem 4) riassembly
    ilasm /dll /key=Key.snk Foo.il 
    

    public by maholtz modified Jul 27, 2015  2060  0  6  0

    Auf Existenz einer Datei in einem Verzeichnis prüfen

    Ganz einfache Funktion für Windows Batch Dateien zur Überprüfung von Verzeichnissen auf die Existenz von bestimmten Dateien in bestimmten Größen.
    REM Aufruf:
    CALL :checkForFile "\\server\pfad\" "Datei*.xml" 1000 2000 "Gesucht wird Datei*.xml"
    
    
    
    :checkForFile
    set verzeichnis=%1
    set zieldateien=%2
    set minDateigroesse=%3
    set maxDateigroesse=%4
    set BETREFF=%5
    
    REM echo Check for %zieldateien% in %verzeichnis% von heute
    echo. 
    echo ! ------------------------------------------
    echo ! %BETREFF%
    
    set DATEI=""
    for /R %verzeichnis% %%f in (%zieldateien%) do (
    	set DATEI=%%f
    	REM echo %%f mit %%~zf
    	if %%~zf LSS %minDateigroesse% (
    		echo FEHLER: Datei %%f ist mit %%~zf Bytes zu klein!
    		SET /a FEHLER=%FEHLER%+1
    		exit /B -1
    	)	
    	if %%~zf GTR %maxDateigroesse% (
    		echo FEHLER: Datei %%f ist mit %%~zf Bytes zu gross!
    		SET /a FEHLER=%FEHLER%+1
    		exit /B -2
    	)
    )
    if %DATEI%=="" (
    	echo FEHLER: Datei fehlt!
    	echo %zieldateien% in %verzeichnis%
    	SET /a FEHLER=%FEHLER%+1
    	exit /B -3
    )
    echo ! OK: %DATEI%
    exit /B 0    

    public by maholtz modified Jul 27, 2015  2566  2  6  0

    Wochentag in Windows-Batch-Datei ermitteln

    REM Wochentag ermitteln
    
    set WOCHENTAG=
    for /f %%g in ('wmic path win32_localtime get dayofweek^|findstr /v /r "^$"') do (
    	set WOCHENTAG=%%g
    )
    if %WOCHENTAG%==0 set WOCHENTAG=So
    if %WOCHENTAG%==1 set WOCHENTAG=Mo
    if %WOCHENTAG%==2 set WOCHENTAG=Di
    if %WOCHENTAG%==3 set WOCHENTAG=Mi
    if %WOCHENTAG%==4 set WOCHENTAG=Do
    if %WOCHENTAG%==5 set WOCHENTAG=Fr
    if %WOCHENTAG%==6 set WOCHENTAG=Sa        
    • Public Snippets
    • Channels Snippets