This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pyspark import SparkContext, SparkConf | |
import pyspark | |
import os | |
os.environ["JAVA_HOME"] = "C:\Program Files\Java\jre1.8.0_151" | |
os.environ['SPARK_HOME']="C:\spark-2.2.1-bin-hadoop2.7" | |
os.environ['HADOOP_HOME']="C:\hadoop-2.7.1" | |
config = SparkConf().setMaster("local[8]").set("spark.executor.memory","8g") | |
spark = pyspark.sql.SparkSession.builder.config(conf=config).appName('test').getOrCreate() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from kazoo.client import KazooClient | |
import json | |
#### | |
# A quick function to get Kafka brokers from Zookeeper | |
### | |
# Probably you need only the first one because the broker will advertise the other brokers | |
# This is need only for producers due there you can only use bootstrap servers | |
# Arguments |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%pyspark | |
import socket,struct | |
import re | |
def inetNtoa(ip,num): | |
ip = re.match("^([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$",socket.inet_ntoa(struct.pack('!I', ip))) | |
str = '' | |
if(num==0 or num > 3): | |
return ip.group(0) | |
else: | |
for i in range(1,num+1): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%pyspark | |
import socket,struct | |
import re | |
def inetNtoa(ip,num): | |
ip = re.match("^([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$",socket.inet_ntoa(struct.pack('!I', ip))) | |
str = '' | |
if(num==0 or num > 3): | |
return ip.group(0) | |
else: | |
for i in range(1,num+1): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#install twitterapi | |
#pip install TwitterAPI | |
#Docs for twittterAPI | |
#https://github.com/geduldig/TwitterAPI | |
#Twitter credentials | |
#https://apps.twitter.com/ | |
#Twitter API docs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--The function is based on http://ole.michelsen.dk/blog/split-string-to-table-using-transact-sql/ | |
--Thx for the core BTW | |
IF OBJECT_ID('Tokenize') IS NOT NULL | |
DROP FUNCTION [dbo].[Tokenize] | |
GO | |
CREATE FUNCTION [dbo].[Tokenize] | |
( | |
@String NVARCHAR(4000), | |
@Delimiter NCHAR(1), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
SET st2Path=C:\Program Files\Sublime Text 3\sublime_text.exe | |
rem add it for all file types | |
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3" /t REG_SZ /v "" /d "Open with Sublime Text 3" /f | |
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3" /t REG_EXPAND_SZ /v "Icon" /d "%st2Path%,0" /f | |
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3\command" /t REG_SZ /v "" /d "%st2Path% \"%%1\"" /f | |
pause |