Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Ankit Goyal goyalankit

🏠
Working from home
View GitHub Profile
@goyalankit
goyalankit / bash_to_zsh_history.rb
Last active Feb 24, 2021
Import bash history to zsh history.
View bash_to_zsh_history.rb
#################################################################
# = This script transfers bash history to zsh history
# = Change bash and zsh history files, if you don't use defaults
#
# = Usage: ruby bash_to_zsh_history.rb
#
# = Author: Ankit Goyal
#################################################################
# change if you don't use default values
@goyalankit
goyalankit / client.py
Last active Feb 2, 2021
TFF Multi Node Toy Example
View client.py
# Copyright 2019, The TensorFlow Federated Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
@goyalankit
goyalankit / two-hour.service
Last active Jul 16, 2020
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
@goyalankit
goyalankit / docker_0.md
Last active Oct 11, 2019
Docker Commands
View docker_0.md

Docker cheatsheet.

  • To get the list of commands:

      $ docker
    
  • To search for images in docker index:

      $ docker search tutorial
    
@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.

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: