Skip to content

Instantly share code, notes, and snippets.

Ankit Goyal goyalankit

Block or report user

Report or block goyalankit

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View t.pl
#!/usr/bin/perl
# Copyright Ben Maurer
# you can distribute this under the MIT/X11 License
my $pid=shift @ARGV;
unless ($pid) {
print "./smem.pl <pid>\n";
exit 1;
}
View config.json
{
"ociVersion": "1.0.0",
"process": {
"terminal": false,
"user": {
"uid": 0,
"gid": 0
},
"args": [
"sh"
View on_modified_decorator.py
import os
import time
from functools import wraps
def memoize_until_file_modified(filepath):
""""Memoize the data until the mtime of the file at filepath changes."""
def memoize_until_file_modified_decorator(func):
@wraps(func)
def decorated(*args, **kwargs):
try:
View keybase.md

Keybase proof

I hereby claim:

  • I am goyalankit on github.
  • I am goyalankit (https://keybase.io/goyalankit) on keybase.
  • I have a public key ASB35EigYuQtVor3E2Z5EX4pOGO8cg17amOaWGkhKMPf0wo

To claim this, I am signing this object:

@goyalankit
goyalankit / is_promiscuous.py
Last active May 9, 2017
Iterate through all the interfaces and check if they are in promiscuous mode.
View is_promiscuous.py
# This script goes through all the network devices on the system
# and determines if the device in promiscuous mode.
#
# More information at: http://goyalankit.com/blog/promiscuous-mode-detection
#
# Usage: python is_promiscuous.py
# Author: Ankit Goyal (http://github.com/goyalankit)
import os
@goyalankit
goyalankit / Netfilter-IPTables-Diagrams.md
Created Apr 22, 2017 — forked from nerdalert/Netfilter-IPTables-Diagrams.md
Linux NetFilter, IP Tables and Conntrack Diagrams
View Netfilter-IPTables-Diagrams.md

Linux NetFilter, IP Tables and Conntrack Diagrams

IPTABLES TABLES and CHAINS

IPTables has the following 4 built-in tables.

1) Filter Table

Filter is default table for iptables. So, if you don’t define you own table, you’ll be using filter table. Iptables’s filter table has the following built-in chains.

@goyalankit
goyalankit / two-hour.service
Last active Jun 18, 2019
Systemd unit files to restart service every two hours.
View two-hour.service
[Unit]
Description=Service that restarts my spread_goodness.service every two hours.
[Service]
Type=oneshot
ExecStart=/usr/bin/systemctl try-restart spread_goodness.service
View minions_both_up.json
{
"action": "get",
"node": {
"key": "/registry/minions",
"dir": true,
"nodes": [{
"key": "/registry/minions/172.17.8.102",
"value": "{\"kind\":\"Node\",\"apiVersion\":\"v1\",\"metadata\":{\"name\":\"172.17.8.102\",\"selfLink\":\"/api/v1/nodes/172.17.8.102\",\"uid\":\"a062c77a-8e97-11e6-84ff-08002794c432\",\"creationTimestamp\":\"2016-10-10T03:14:16Z\",\"labels\":{\"beta.kubernetes.io/arch\":\"amd64\",\"beta.kubernetes.io/os\":\"linux\",\"kubernetes.io/hostname\":\"172.17.8.102\"},\"annotations\":{\"volumes.kubernetes.io/controller-managed-attach-detach\":\"true\"}},\"spec\":{\"externalID\":\"172.17.8.102\"},\"status\":{\"capacity\":{\"alpha.kubernetes.io/nvidia-gpu\":\"0\",\"cpu\":\"1\",\"memory\":\"2053160Ki\",\"pods\":\"110\"},\"allocatable\":{\"alpha.kubernetes.io/nvidia-gpu\":\"0\",\"cpu\":\"1\",\"memory\":\"2053160Ki\",\"pods\":\"110\"},\"conditions\":[{\"type\":\"OutOfDisk\",\"status\":\"False\",\"lastHeartbeatTime\":\"2016-10-10T03:47:28Z\",\"lastTransitionTime\":\"2016-10-10T03:14:16Z\",
View dockercon
dockerswarm
----
highly available, fault tolerant. replacing kubernates?
docker service
--------
- labels to target hosts. using constraints.
You can’t perform that action at this time.