Skip to content

Instantly share code, notes, and snippets.

View muhammetfaik's full-sized avatar
🏢
Working from Company

Muhammet Faik muhammetfaik

🏢
Working from Company
View GitHub Profile
@muhammetfaik
muhammetfaik / turbox_build.sh
Last active October 31, 2023 08:19
turbobox_build.sh
#!/bin/bash
# Author: Jiao Lining <lining.jiao@thundercomm.com>
# Date: 2020-01-22
# Copyright (c) 2020, Thundercomm All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, shrink-to-fit=no">
<title>Register Cover | CORK - Multipurpose Bootstrap Dashboard Template </title>
<link rel="icon" type="image/x-icon" href="assets/img/favicon.ico"/>
<!-- BEGIN GLOBAL MANDATORY STYLES -->
<link href="https://fonts.googleapis.com/css?family=Nunito:400,600,700" rel="stylesheet">
@muhammetfaik
muhammetfaik / spellchecker.py
Created February 10, 2020 12:00
spellchecker
import jamspell
corrector = jamspell.TSpellCorrector()
corrector.LoadLangModel('en.bin')
print(corrector.FixFragment('I am the begt spell cherken!'))
# u'I am the best spell checker!'
print(corrector.GetCandidates(['i', 'am', 'the', 'begt', 'spell', 'cherken'], 3))
# (u'best', u'beat', u'belt', u'bet', u'bent', ... )
class Publisher
# In order to publish message we need a exchange name.
# Note that RabbitMQ does not care about the payload -
# we will be using JSON-encoded strings
def self.publish(exchange, message = {})
# grab the fanout exchange
x = channel.fanout("dbcountermain#{exchange}")
# and simply publish message
x.publish(message.to_json)
end
class Publisher
# In order to publish message we need a exchange name.
# Note that RabbitMQ does not care about the payload -
# we will be using JSON-encoded strings
def self.publish(exchange, message = {})
# grab the fanout exchange
x = channel.fanout("dbcountermain#{exchange}")
# and simply publish message
x.publish(message.to_json)
end
class Publisher
# In order to publish message we need a exchange name.
# Note that RabbitMQ does not care about the payload -
# we will be using JSON-encoded strings
def self.publish(exchange, message = {})
# grab the fanout exchange
x = channel.fanout("dbcountermain#{exchange}")
# and simply publish message
x.publish(message.to_json)
end
text_file = spark.textFile("hdfs://...")
text_file.flatMap(lambda line: line.split())
.map(lambda word: (word, 1))
.reduceByKey(lambda a, b: a+b)