Skip to content

Instantly share code, notes, and snippets.

@trolologuy
trolologuy / macOS - Tips & Tricks
Last active May 2, 2020 16:49
macOS - Tips & Tricks
# Open current folder from terminal into the finder
open .
https://support.apple.com/en-us/HT201372
https://eshop.macsales.com/guides/Mac_OS_X_Compatibility
@trolologuy
trolologuy / unminify.py
Created March 16, 2020 14:35
Simple python script to unminify JSON
#!/usr/bin/python
import json
import argparse
def read_json(args):
"Reads and unminifies the JSON input"
with open(args.filename) as json_data:
data = json.load(json_data)
data_unminified = json.dumps(data, indent=4)
print(data_unminified)
@trolologuy
trolologuy / notify.sh
Last active April 7, 2021 02:07
Simple Telegram notifications bot using curl. Planned for use with travis to get notified on build status sending most of the required information added a login-notifier as well..
#!/bin/bash
curl -fqsSL gist.githubusercontent.com/trolologuy/c290ac3edc46fe6bc2b69ccc497cd4bc/raw/53f038f266bbbbff342c549e77c10f4fc401f2a9/telegram-notifier.sh | bash
@trolologuy
trolologuy / tampermonkey google meet
Created July 29, 2020 10:42
tampermonkey google meet
// ==UserScript==
// @name Open in new tab any link on google meet
// @namespace http://userscripts.org/users/4294
// @description Makes links open in a new window
// @include https://meet.google.com/*
// @grant window.close
// ==/UserScript==
(function() {
'use strict';
@trolologuy
trolologuy / Vagrantfile
Last active August 20, 2020 10:04
Example for stackoverflow question 63502738 regarding MOTD issues with vagrant
Vagrant.require_version ">= 2.2.3"
Vagrant.configure("2") do |config|
config.vm.provider "virtualbox" do |v|
v.memory = 2048
v.cpus = 2
end
config.vm.box = "ubuntu/bionic64"
config.vm.hostname = "cli-tools"
config.vm.provision "ansible", type: "ansible" do |ansible|
@trolologuy
trolologuy / parse_access_log.sh
Created January 27, 2021 13:50
A simple bash oneliner to parse the server's access.log file to split by http error codes and count them individually.
tail -n 5000 /var/log/access.log | awk '{print $9}' | sort | uniq -c | sort -nr | head -n15
# Example of output:
# 2625 499
# 1433 500
# 569 200
# 243 401
# 108 404
# 16 301
# 6 302
@trolologuy
trolologuy / parse_access_log.sh
Created January 27, 2021 13:51
A simple bash oneliner to parse the server's access.log file to split by http error codes and count them individually. By default it browses `/var/log/access.log` and limit's the search on the last `5000` lines.
tail -n 5000 /var/log/access.log | awk '{print $9}' | sort | uniq -c | sort -nr | head -n15
# Example of output:
# 2625 499
# 1433 500
# 569 200
# 243 401
# 108 404
# 16 301
# 6 302