Skip to content

Instantly share code, notes, and snippets.

View totomz's full-sized avatar

Tommaso Doninelli totomz

View GitHub Profile
<script>
hbspt.forms.create({
portalId: "0000",
formId: "aaa-bbbb-cccc",
onFormReady: function($form){
var input = $form.find('input[type=email]');
input.addClass('form-control');
input.attr('placeholder','Enter your e-mail address');
@totomz
totomz / phpnet.user.js
Created May 14, 2018 15:22
Greasemonkey/Tampermonkey redirect php.net pages to the ENG version
// ==UserScript==
// @name PHP Manual redirect
// @namespace https://github.com/totomz
// @version 0.1
// @description Force contents fro php.net/manual to be served in ENG!
// @author You
// @match http://php.net/manual/*
// @grant none
// ==/UserScript==
@totomz
totomz / send-to-cloudwatch.sh
Last active September 11, 2023 08:37
A simple script to push a JSON log to AWS CLoudWatch
#!/bin/bash
AWS_REGION="--region XXX_REGION"
AWS_PROFILE="--profile XXX_PROFILE"
LOG_GROUP="XXX_YOUR_LOG_GROUP"
LOG_STREAM="$(whoami)-$( date "+%Y%m%d-%H-%M-%S")"
aws logs create-log-stream --log-group-name $LOG_GROUP --log-stream-name $LOG_STREAM $AWS_REGION $AWS_PROFILE
@totomz
totomz / gist:b00855bf66d3f85b04b54b5a35c17012
Created June 13, 2017 19:35
AppleScript to launch new windows instead of moving focus
# iTerm
```
tell application "iTerm"
set newWindow to (create window with default profile)
tell newWindow
activate
end tell
end tell
```
@totomz
totomz / gist:ea7944ae9dd45930f10a
Created January 22, 2016 10:18
Monitor downloaded files
while true; do echo $(date +%H:%M:%S) $(awk "BEGIN { printf \"%6.2f%\n\", $(ls | grep -v .gstmp | wc -l)/135530 *100 }") $(df -h --output=avail /dev/sdd2 | awk END{print}) free; sleep 3; done
@totomz
totomz / gist:387910fb497f35d41c15
Created December 24, 2014 17:34
[GCE] Mounting disk
# Mounting pgdata disk
parted -s /dev/disk/by-id/google-pgdata mktable gpt
parted -s /dev/disk/by-id/google-pgdata mkpart primary ext4 0% 100%
sleep 5
mkfs.ext4 /dev/disk/by-id/google-pgdata-part1 -L pgdata
sleep 2
mkdir $PGDATA_MOUNT
echo "/dev/disk/by-id/google-pgdata-part1 $PGDATA_MOUNT ext4 noatime,data=writeback,barrier=0,nobh 0 2" >> /etc/fstab
mount -a
@totomz
totomz / gist:4d033fa1b991504a4e31
Last active August 29, 2015 14:12
[GCE] Download and execute a powershell startup script from Google Cloud Storage in Google Cloud Engine
$gscript = "test-script/startup.ps1";Invoke-Expression $(Invoke-RestMethod -Uri $("https://storage-download.googleapis.com/"+$gscript+"?access_token=" + $($(Invoke-RestMethod -Uri "http://metadata/computeMetadata/v1/instance/service-accounts/default/token" -Headers @{"Metadata-Flavor"="Google"}).access_token)));
@totomz
totomz / gist:8523544
Created January 20, 2014 16:36
Export an Excel to a SQL-like text file
Sub ExportSQL()
Dim FilePath As String
Dim CellData As String
Dim LastCol As Long
Dim LastRow As Long
CellData = ""
FilePath = Application.ActiveWorkbook.Path & "\insert.sql"