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
karthikrp / port_scan.py
Created Oct 24, 2016
Simple port scanner in python
View port_scan.py
#!/usr/bin/python
# Visit Codingsec.net
# 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
karthikrp / django_shell_to_csv.py
Created Aug 31, 2016
Django Shell to CSV Dump
View django_shell_to_csv.py
import csv
def get_field(instance, field):
field_path = field.split('.')
attr = instance
for elem in field_path:
try:
attr = getattr(attr, elem)
except AttributeError:
return None
You can’t perform that action at this time.