View ansible-filter-fact-with-jq.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ cat <<EOF > reduce.jq | |
def pick($paths): | |
. as $root | reduce $paths[] as $path ({}; . + { ($path): $root[$path] }); | |
.ansible_facts | pick(["ansible_kernel", "ansible_distribution", "ansible_kernel_version"]) | |
EOF | |
$ ansible -m setup localhost | sed '1 s/^.*|.*=>.*$/{/g' | jq -f reduce.jq | |
{ | |
"ansible_kernel": "13.1-RELEASE-p3", |
View gist:3c23c52d6817246b3682922944a9c3ba
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git c/cmd/crowdsec-cli/machines.go w/cmd/crowdsec-cli/machines.go | |
index bbdf11c..33e87e9 100644 | |
--- c/cmd/crowdsec-cli/machines.go | |
+++ w/cmd/crowdsec-cli/machines.go | |
@@ -7,6 +7,7 @@ import ( | |
"io/ioutil" | |
"math/big" | |
"os" | |
+ "runtime" | |
"strings" |
View tf-init.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -o errexit | |
set -o nounset | |
set -o pipefail | |
readonly TF_VERSION="v0.11" | |
output_line() { |
View aws_route53_detection.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import ipaddress | |
import boto3 | |
from pprint import pprint as pp | |
# | |
# This script iterate over our regions in order to collect all the private IPs | |
# and check if the ResourceRecord created has still an existing IPs |
View pyflame.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
sudo apt-get install -y autoconf automake autotools-dev g++ pkg-config python-dev python3-dev libtool make | |
[ ! -f ./flamegraph.pl ] && { | |
curl -O https://raw.githubusercontent.com/brendangregg/FlameGraph/master/flamegraph.pl | |
} | |
[ ! -f /usr/local/bin/pyflame -o ! -d pyflame ] && { | |
git clone https://github.com/uber/pyflame.git | |
cd pyflame |
View tty-size.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <sys/ioctl.h> | |
#include <stdio.h> | |
#include <unistd.h> | |
int | |
main(void) { | |
struct winsize ws; | |
ioctl(STDIN_FILENO, TIOCGWINSZ, &ws); | |
printf ("lines %d\n", ws.ws_row); |
View tty-size.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import termios | |
import fcntl | |
import os | |
import struct | |
with open(os.ctermid(), 'r') as fd: | |
packed = fcntl.ioctl(fd, termios.TIOCGWINSZ, struct.pack('HHHH', 0, 0, 0, 0)) | |
rows, cols, h_pixels, v_pixels = struct.unpack('HHHH', packed) | |
print rows, cols, h_pixels, v_pixels |
View mz-tab-urls.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import ConfigParser | |
import json | |
import os | |
""" | |
Dirty script to get Mozilla Firefox tabs URLs on stdout | |
source: https://raymii.org/s/snippets/Get_the_current_or_all_Firefox_tab_urls_in_Bash.html |
View freebsd.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"@base": { | |
"files": [ | |
{ | |
"make.conf": { | |
"filename": "make.conf", | |
"dirpath": "/etc/", | |
"@destination": "/etc/make.conf", | |
"@content": { | |
"svn_update": "yes", |
View auxv.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <elf.h> | |
/* /usr/include/x86/elf.h AT_* defs */ | |
typedef struct { | |
const char *str_val; | |
int type; | |
} Elf_AuxStr; | |
NewerOlder