Skip to content

Instantly share code, notes, and snippets.

Karthik karthikrp

Block or report user

Report or block karthikrp

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 cassidyChallenge.js
# Cassidoo Newsletter Challenge - 2/21/19
removeForOdd = (arr) => {
const sum = arr.reduce((a, b) => a + b);
if (sum % 2 !== 0) {
return -1;
return arr.findIndex(x => x % 2 !== 0);
karthikrp /
Created Oct 24, 2016
Simple port scanner in python
# Visit
# Importing the modules
# socket :=> This is what we use to create a socket connection
# argparse is used to parse arguments. This is not important now
# and it is out of the scope of this post
import socket,sys,time,datetime,argparse,os
flag = 0 # we're gonna use this flag later. Just keep it in mind
karthikrp /
Created Aug 31, 2016
Django Shell to CSV Dump
import csv
def get_field(instance, field):
field_path = field.split('.')
attr = instance
for elem in field_path:
attr = getattr(attr, elem)
except AttributeError:
return None
You can’t perform that action at this time.