Skip to content

Instantly share code, notes, and snippets.

View blended-ideas's full-sized avatar
🥁
Ba Dum Tss..!!

Karthik blended-ideas

🥁
Ba Dum Tss..!!
View GitHub Profile
@blended-ideas
blended-ideas / django_secret.txt
Created May 5, 2020 04:07
Django Secret Key Generator
# Python Way of generating
python -c 'import random; print("".join([random.choice("abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)") for i in range(50)]))'
# Using Linux
base64 /dev/urandom | head -c50
# or (slower)
base64 /dev/urandom | head -c50
# 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);
}
@blended-ideas
blended-ideas / port_scan.py
Created October 24, 2016 09:08
Simple port scanner in python
#!/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
@blended-ideas
blended-ideas / django_shell_to_csv.py
Created August 31, 2016 10:22
Django Shell to CSV Dump
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