Skip to content

Instantly share code, notes, and snippets.

View acataluddi's full-sized avatar

Adriano C. acataluddi

View GitHub Profile
$LogPath = "C:\inetpub\logs\LogFiles\W3SVC1\*"
$LogFiles = "*.log"
[int] $LogRetention = "-30" # in Days
Get-ChildItem $LogPath -Include $LogFiles -Recurse | Where-Object {$_.LastWriteTime -lt (Get-Date).AddDays($LogRetention)} | Remove-Item
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Remove Magento's orphan images web console</title>
<link href='https://fonts.googleapis.com/css?family=Open+Sans+Condensed:300,700' rel='stylesheet' type='text/css'>
<link href='https://fonts.googleapis.com/css?family=Inconsolata:400,700&subset=latin,latin-ext' rel='stylesheet'
type='text/css'>
<style type="text/css">
$ sudo apt-get install cryptsetup # or on redhat - yum install cryptsetup-luks
Reading package lists... Done
Building dependency tree
Reading state information... Done
cryptsetup is already the newest version (2:1.6.6-5ubuntu2).
0 upgraded, 0 newly installed, 0 to remove and 63 not upgraded.
$ truncate -s 100m myencryptedcontainer
$ cryptsetup -y -v luksFormat myencryptedcontainer
@acataluddi
acataluddi / README.md
Created November 5, 2022 16:38 — forked from 0x3333/README.md
List mounted points in columns

This is an alias to shells to display mount output in formatted columns.

Add this alias to your rc shell(.bashrc, .zshrc, or whatever):

alias mountc='mount | column -t | sort -V'

Example output:

@acataluddi
acataluddi / api.php
Created September 6, 2021 10:09 — forked from pixelbrackets/api.php
Simple PHP script to test and use cURL
<?php
/**
* Simple request response script
*
* Point you cURL request to this script to see all incoming data
*/
echo '*API*'. PHP_EOL;
@acataluddi
acataluddi / opt1_template.j2
Created May 6, 2021 15:11 — forked from halberom/opt1_template.j2
ansible - example of template if else
{# style 1 - long form #}
{% if filepath == '/var/opt/tomcat_1' %}
{% set tomcat_value = tomcat_1_value %}
{% else %}
{% set tomcat_value = tomcat_2_value %}
{% endif %}
{# style 2 - short form #}
{% set tomcat_value = tomcat_1_value if (filepath == '/var/opt/tomcat_1') else tomcat_2_value %}
@acataluddi
acataluddi / fiddle.js
Created September 11, 2020 14:42 — forked from rlmcneary2/fiddle.js
Demonstrate use of jQuery $.ajax with an array of jqXHR Deferred Promise objects passed to the $.when function.
// Seeing this through jsfiddle?
// Get the source from github gist: https://gist.github.com/1873879
// Create an array with two jqXHR objects from two separate $.ajax calls.
var arrJqx = [];
// This call has no delay and the response will come back from the server
// almost immediately.
arrJqx.push($.ajax ({
url: "/echo/json/",
@acataluddi
acataluddi / Build NPM Package.md
Last active April 8, 2020 17:37 — forked from tmpvar/my-first-module.md
how to create your very first node.js module and publish it to the npm registry

Building an NPM package

This is pretty simple, lets dive in!

Choose a name

Find a name that isn't taken and clearly describes what your module is doing

$ npm view your-first-node-module
@acataluddi
acataluddi / git-recover-branch.md
Created February 22, 2020 18:07 — forked from jbgo/git-recover-branch.md
How to recover a git branch you accidentally deleted

UPDATE: A better way! (August 2015)

As pointed out by @johntyree in the comments, using git reflog is easier and more reliable. Thanks for the suggestion!

 $ git reflog
1ed7510 HEAD@{1}: checkout: moving from develop to 1ed7510
3970d09 HEAD@{2}: checkout: moving from b-fix-build to develop
1ed7510 HEAD@{3}: commit: got everything working the way I want
70b3696 HEAD@{4}: commit: upgrade rails, do some refactoring
@acataluddi
acataluddi / change_ini_file_preserving_symlinks.yml
Created October 11, 2019 13:00
Modify a symlinked INI file avoiding the Ansible's bug replacing the symlink with a copy of the target file