Skip to content

Instantly share code, notes, and snippets.

View belenaj's full-sized avatar

Jorge belenaj

View GitHub Profile
#!/bin/sh
#
# Copyright
#
# Check for the correct # of arguments:
# Use this syntax or use: if [ $# -lt 3 ]
echo "$# arguments were supplied."
if [ $# -lt 3 ]
<?xml version=”1.0" encoding=”UTF-8"?>
<viewentries timestamp=”20171026T092215,59Z”>
<item position=”1" >
<entrydata name=”OrderDate”>
<datetime dst=”true”>20171026T102513,86+02</datetime></entrydata>
<entrydata name=”Country”>
<text>Spain</text></entrydata>
</item>
<item position=”2" >
<entrydata name=”OrderDate”>
@belenaj
belenaj / SSIS.GenerateDatekeyInt.md
Last active November 22, 2017 13:07
SSIS | Generate Datekey (int) from Date field #SSIS #date #YYYYMMDD

SSIS | Generate Datekey (int) from Date field

This expression will extract the date from the field in format YYYYMMDD and it will be converted to integer

i.e. '2017-01-03 13:18:13.667' --> 20170103 (int) Just replace for your field name

@belenaj
belenaj / SSIS.DateToYYYYMMDDString.md
Last active November 22, 2017 13:08
SSIS | Date to YYYYMMDD String #SSIS #Date #String #YYYYMMDD

SSIS | Date to YYYYMMDD String

This expression will convert a datetime field in format YYYYMMDD

i.e. with <datetime> ='2017-01-03 13:18:13.667' it will return 20170103 [String (8)]

Just replace for your field name

(DT_WSTR, 8)REPLACE((DT_WSTR, 10)(DT_DBDATE),"-","")
@belenaj
belenaj / SSIS Utilities
Last active August 3, 2018 11:49
SSIS Utilities
.
@belenaj
belenaj / remove-orphaned-raw-images.py
Created December 9, 2017 09:22 — forked from pklaus/remove-orphaned-raw-images.py
Do you own a DSLR? If so, do you transfer your images to your computer, then look at the JPEGs and delete the crappy ones? If you do, your RAW images may be leftover. This Python script helps you cleaning up your image folders after deleting unwanted JPEGs. See http://blog.philippklaus.de/2012/12/cleaning-leftover-raw-images-after-selecting-imag…
#!/usr/bin/env python2.7
# -*- coding: utf-8 -*-
"""
Written on 2012-12-12 by Philipp Klaus <philipp.l.klaus →AT→ web.de>.
Check <https://gist.github.com/4271012> for newer versions.
Also check <https://gist.github.com/3155743> for a tool to
rename JPEGs according to their EXIF shot time.
"""
@belenaj
belenaj / createBigXML.sh
Created April 6, 2018 10:32
Creates a XML Dummy File of with a specific number of rows in the body. Includes header and footer
#!/bin/bash
iterations=100000
fileName=myFile.xml
# header
echo "<?xml version="1.0" encoding="UTF-8"?>
<file>
<veryBig>
<wantedTag>Hello World</wantedTag>
@belenaj
belenaj / size-aws-bucket.md
Last active June 7, 2018 11:56
How to get the size of an Amazon S3 bucket

s4cmd is the fastest way I've found (a command-line utility written in Python):

pip install s4cmd

Now to calculate the entire bucket size using multiple threads:

s4cmd du -r s3://bucket-name

@belenaj
belenaj / split-file.md
Last active September 9, 2020 09:05
[How to split a file by size but keeping full lines] #bash #file
@belenaj
belenaj / Sql-utils
Last active June 14, 2018 12:05
Dynamic SQL statement to replace the path of one or more Oracle Directories || #directory #oracle #sql
.