Skip to content

Instantly share code, notes, and snippets.

View iflowfor8hours's full-sized avatar
💭
on the lookout.

mxs iflowfor8hours

💭
on the lookout.
View GitHub Profile
@tianchaijz
tianchaijz / tips_lsof.sh
Last active January 24, 2022 02:41 — forked from sergepetit/tips_lsof.sh
Shell command lsof : see open files and ports; Selection is OR by default, use -a for AND; Tested on OSX
#list all ports for tcp
sudo lsof -itcp
#find all things listening on ports
lsof -Pnl +M -i4 | grep LISTEN
#all ports for tcp, dont resolve port name from numbers
sudo lsof -itcp -P
#open files and ports of process #$PID
@sivel
sivel / inventory2json.py
Last active December 19, 2023 01:54
Ansible inventory to dynamic inventory JSON output, accepts all inventory input formats
import sys
import json
from ansible.parsing.dataloader import DataLoader
try:
from ansible.inventory.manager import InventoryManager
A24 = True
except ImportError:
from ansible.vars import VariableManager
#!/usr/bin/env ruby1.9.3
require 'pg'
require 'optparse'
require 'tmpdir'
require 'shellwords'
require 'socket'
require 'json'
require 'digest'
require 'public_suffix'
@a-dma
a-dma / yubitouch.sh
Last active March 10, 2022 14:43
Bash script for setting or clearing touch requirements for cryptographic operations in the OpenPGP application on a YubiKey 4.
#!/bin/bash
# Bash script for setting or clearing touch requirements for
# cryptographic operations the OpenPGP application on a YubiKey 4.
#
# Author: Alessio Di Mauro <alessio@yubico.com>
GCA=$(which gpg-connect-agent)
DO=0
UIF=0
#!/bin/bash
# This script will submit all pending commits to gerrit and will automatically
# add reviewers to the associated change. Reviewers can be added by simply
# listing them after greview. You can either enter their full email addresses
# or just partially enter a unique combination of letters that will be
# fuzy-matched to either the email or the name of the commiters.
#
# Usage: greview <reviewer-1> <reviewer-2> ...
@mauvm
mauvm / gist:5de07085f3b51e117378
Created July 26, 2015 11:57
An "envsubst" alternative for replacing env variables in NGinX site configurations (for using it with Docker)
#!/bin/bash
# NOTE: Brackets are not supported and '$' in values will break the script.
mkdir /etc/nginx/sites-enabled 2> /dev/null
for file in /etc/nginx/sites-available/*.conf
do
TPL=$(cat $file)
for row in $(env)
do
@bnagy
bnagy / gpgmutt.md
Last active March 30, 2024 07:52
Mutt, Gmail and GPG

GPG / Mutt / Gmail

About

This is a collection of snippets, not a comprehensive guide. I suggest you start with Operational PGP.

Here is an incomplete list of things that are different from other approaches:

  • I don't use keyservers. Ever.
  • Yes, I use Gmail instead of some bespoke hipster freedom service
@jewzaam
jewzaam / README.md
Last active April 25, 2016 15:00 — forked from Ulrhol/README.md

##Yet another gist to provide Graphite support for Dashing Pull data from Graphite and present in Dashing. Support both graph and number widget.

Quick install:

dashing install efffa657c31e244131e3

Set the graphite name and names of metrics in jobs/graphite.rb

@softwaredoug
softwaredoug / ubuntu_py3.md
Last active November 9, 2021 19:38
Ubuntu 14.04 Python 3.4.2 Setup using pyenv and pyvenv

What I did to get Python 3.4.2 on Ubuntu 14.04. The stock version of Python 3 on Ubuntu is 3.4.0. Which is missing some of the best parts! (asyncio, etc). Luckily I discovered pyenv which solved my problem.

Install pyenv

Pyenv (not to be confused with pyvenv) is the Python equivelant of rbenv. It lets you configure which Python environment/version is available per directory, user, or other session variables.

I followed the instructions here to install pyenv in my home directory. Verbatem, those instructions are:

sudo apt-get install git python-pip make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev
@jacobblock
jacobblock / FreeNAS.md
Last active October 22, 2023 13:01
Ultimate FreeNAS Setup

FreeNAS

I started using FreeNAS in August 2013. It is fantastic piece of software and I have been really impressed by the upgrades just in the few months I've been using it. It looks like they recently went to a plugin system as of version 9 to make installing software easier for end users. I've ran into several issues related to plugins and user + group permissions so I decided to just use the available FreeBSD port system. After fiddling for a few days (now turned into months) I believe I have created something helpful for the community and anyone interested in picking up the port system. The sandbox nature of FreeNAS's jail system is especially helpful for playing around without having any consequence on your core system.

Here are straight-forward instructions to setting up a bunch of different software on FreeNAS. If you make a terrible error, just throw up another plugin sandbox and repeat.

ToC