Skip to content

Instantly share code, notes, and snippets.

View preetham-salehundam's full-sized avatar
🎯
NLP enthusiast, Mars Invader!

Preetham Salehundam preetham-salehundam

🎯
NLP enthusiast, Mars Invader!
View GitHub Profile
@preetham-salehundam
preetham-salehundam / verify_mp3.py
Last active May 30, 2022 22:26
verify if the file is a valid mp3
"""
works with python3.7
"""
def is_valid_mp3(filelike):
"""
Stolen from:
http://blog.eringal.com/python/verifying-that-an-mp3-file-is-valid-in-python/
import pyspark
from pyspark.sql import SparkSession
from pyspark.sql.functions import col, udf
from pyspark.sql.types import StringType
spark = SparkSession.builder.appName('SparkByExamples.com').getOrCreate()
columns = ["Seqno","Name"]
data = [("1", "john jones"),
("2", "tracey smith"),
from pyspark.sql import SparkSession
spark = SparkSession.builder.appName('SparkByExamples.com').getOrCreate()
data=[("Z", 1),("A", 20),("B", 30),("C", 40),("B", 30),("B", 60)]
inputRDD = spark.sparkContext.parallelize(data)
listRdd = spark.sparkContext.parallelize([1,2,3,4,5,3,2])
#aggregate
seqOp = (lambda x, y: x + y)
combOp = (lambda x, y: x + y)
def foo():
return "function foo"
print(foo, " called")
@preetham-salehundam
preetham-salehundam / graph.json
Last active June 15, 2019 20:42
graph-71-users
{"directed": true, "multigraph": false, "graph": {}, "nodes": [{"name": "ffaxvahe5-3-243.cox.rr.com", "type": "agent", "group": "users", "id": "ffaxvahe5-3-243.cox.rr.com"}, {"name": "Wrc-200-D.resnet.emory.edu", "type": "agent", "group": "users", "id": "Wrc-200-D.resnet.emory.edu"}, {"name": "CliffordAdams", "type": "agent", "group": "users", "id": "CliffordAdams"}, {"name": "proxy8.senet.com.au", "type": "agent", "group": "users", "id": "proxy8.senet.com.au"}, {"name": "cs9353-70.austin.rr.com", "type": "agent", "group": "users", "id": "cs9353-70.austin.rr.com"}, {"name": "SanfordDaniel", "type": "agent", "group": "users", "id": "SanfordDaniel"}, {"name": "KlausSeistrup", "type": "agent", "group": "users", "id": "KlausSeistrup"}, {"name": "WojPob", "type": "agent", "group": "users", "id": "WojPob"}, {"name": "24-25-198-151.san.rr.com", "type": "agent", "group": "users", "id": "24-25-198-151.san.rr.com"}, {"name": "JoshuaGrosse", "type": "agent", "group": "users", "id": "JoshuaGrosse"}, {"name": "LarrySanger
@preetham-salehundam
preetham-salehundam / toy-graph-hashes.json
Last active June 11, 2019 20:54
toy-graph with 71 users
This file has been truncated, but you can view the full file.
{
"directed": true,
"multigraph": false,
"graph": {},
"nodes": [
{
"revision_id": 463643962,
"categories": [
"Redirects with old history",
"Unprintworthy redirects"
@preetham-salehundam
preetham-salehundam / AppendLL.java
Created August 19, 2018 17:45
Pre-Reqs-Fundamentals-Of-CS-Java
package demo.tutorials.demo;
import java.util.List;
/**
* Created by Preetham on 04/08/18.
*
* pseudo code
*
* start from head of the linkedlist 1
@preetham-salehundam
preetham-salehundam / The Technical Interview Cheat Sheet.md
Created August 3, 2018 11:49 — forked from tsiege/The Technical Interview Cheat Sheet.md
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.

Studying for a Tech Interview Sucks, so Here's a Cheat Sheet to Help

This list is meant to be a both a quick guide and reference for further research into these topics. It's basically a summary of that comp sci course you never took or forgot about, so there's no way it can cover everything in depth. It also will be available as a gist on Github for everyone to edit and add to.

Data Structure Basics

###Array ####Definition:

  • Stores data elements based on an sequential, most commonly 0 based, index.
  • Based on tuples from set theory.
@preetham-salehundam
preetham-salehundam / firewall-open.sh
Created July 12, 2018 05:50
ubuntu firewall port opening
sudo firewall-cmd --zone=public --add-port=8082/tcp --permanent
sudo firewall-cmd --reload
sudo firewall-cmd --list-all | grep 8082
package com.jpa.demo.repo;
import com.jpa.demo.entities.Customer;
import java.util.List;
/**
*
* The class that implements should contain the IMPL postfix for spring recognise and provide implementation during run time
*