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); |
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/capability.h> | |
#include <sys/types.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <unistd.h> | |
#define nitems(x) (sizeof(x) / sizeof(x[0])) | |
int | |
main(void) { |
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", |
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/socket.h> | |
#include <arpa/inet.h> | |
#include <sys/un.h> | |
#include <unistd.h> | |
#include <string.h> | |
#include <stdio.h> | |
#define _PATH_UNIX_X "/tmp/.X11-unix/X%d" | |
#define DISPLAY_PORT 0 |
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
def hexdump(src, length=16): | |
FILTER = ''.join([(len(repr(chr(x))) == 3) and chr(x) or '.' for x in range(256)]) | |
lines = [] | |
for c in xrange(0, len(src), length): | |
chars = src[c:c+length] | |
hex = ' '.join(["%02x" % ord(x) for x in chars]) | |
printable = ''.join(["%s" % ((ord(x) <= 127 and FILTER[ord(x)]) or '.') for x in chars]) | |
lines.append("%04x %-*s %s\n" % (c, length*3, hex, printable)) | |
return ''.join(lines) |
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 <err.h> | |
#include <fcntl.h> | |
#include <gelf.h> | |
#include <stdint.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <sysexits.h> | |
#include <unistd.h> | |
static void |
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" |
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 os | |
import requests | |
import subprocess | |
import sys | |
from pprint import pprint as pp | |
TOKEN = 'YOUR_TOKEN' |
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() { |
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 |
NewerOlder