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
$ 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 / mysql-drop-all-tables.sh
Created September 18, 2019 21:08 — forked from cweinberger/mysql-drop-all-tables.sh
drops all tables of a specific db
#!/bin/bash
#usage: mysql-drop-all-tables -d database -u dbuser -p dbpass
TEMP_FILE_PATH='./drop_all_tables.sql'
while getopts d:u:p: option
do
case "${option}"
in
@acataluddi
acataluddi / User.php
Created February 3, 2019 20:10 — forked from Ocramius/User.php
Doctrine 2 ManyToMany - the correct way
<?php
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;
/**
* @ORM\Entity()
* @ORM\Table(name="user")
*/
class User