Skip to content

Instantly share code, notes, and snippets.

Avatar

Menuka Warushavithana menuka94

View GitHub Profile
@menuka94
menuka94 / pandas_to_spark.py
Created May 12, 2021 — forked from zaloogarcia/pandas_to_spark.py
Script for converting Pandas DF to Spark's DF
View pandas_to_spark.py
from pyspark.sql.types import *
# Auxiliar functions
# Pandas Types -> Sparks Types
def equivalent_type(f):
if f == 'datetime64[ns]': return DateType()
elif f == 'int64': return LongType()
elif f == 'int32': return IntegerType()
elif f == 'float64': return FloatType()
else: return StringType()
@menuka94
menuka94 / Count lines in Git repo
Created Jul 13, 2020 — forked from mandiwise/Count lines in Git repo
A command to calculate lines of code in all tracked files in a Git repo
View Count lines in Git repo
// Reference: http://stackoverflow.com/questions/4822471/count-number-of-lines-in-a-git-repository
$ git ls-files | xargs wc -l
View mongodb_cheat_sheet.md

MongoDB Cheat Sheet

Show All Databases

show dbs

Show Current Database

View country-bounding-boxes.py
# extracted from http//www.naturalearthdata.com/download/110m/cultural/ne_110m_admin_0_countries.zip
# under public domain terms
country_bounding_boxes = {
'AF': ('Afghanistan', (60.5284298033, 29.318572496, 75.1580277851, 38.4862816432)),
'AO': ('Angola', (11.6400960629, -17.9306364885, 24.0799052263, -4.43802336998)),
'AL': ('Albania', (19.3044861183, 39.624997667, 21.0200403175, 42.6882473822)),
'AE': ('United Arab Emirates', (51.5795186705, 22.4969475367, 56.3968473651, 26.055464179)),
'AR': ('Argentina', (-73.4154357571, -55.25, -53.628348965, -21.8323104794)),
'AM': ('Armenia', (43.5827458026, 38.7412014837, 46.5057198423, 41.2481285671)),
@menuka94
menuka94 / grep-proxy-authorization.out
Last active Aug 1, 2019
Output of "cat wire-logs | grep "Proxy-Authorization"
View grep-proxy-authorization.out
[2019-07-25 17:12:03,844] DEBUG - wire HTTP-Sender I/O dispatcher-8 << "Proxy-Authorization: Basic YWRtaW46YWRtaW4=[\r][\n]"
[2019-07-25 17:12:03,847] DEBUG - wire HTTP-Sender I/O dispatcher-4 << "Proxy-Authorization: Basic [0x0][0x0][0x0][0x0][0x0][0x0][0x0][0x0][0x0][0x0][0x0][0x0][0x0][0x0][0x0][0x0][\r][\n]"
[2019-07-25 17:12:03,848] DEBUG - wire HTTP-Sender I/O dispatcher-12 << "Proxy-Authorization: Basic [0x0][0x0][0x0][0x0][0x0][0x0][0x0][0x0][0x0][0x0][0x0][0x0][0x0][0x0][0x0][0x0][\r][\n]"
[2019-07-25 17:12:03,856] DEBUG - wire HTTP-Sender I/O dispatcher-6 << "Proxy-Authorization: Basic YWRtaW46YWRtaW4=[\r][\n]"
[2019-07-25 17:12:03,859] DEBUG - wire HTTP-Sender I/O dispatcher-5 << "Proxy-Authorization: Basic YW[0x0][0x0][0x0][0x0][0x0][0x0][0x0][0x0][0x0][0x0][0x0][0x0][0x0][0x0][\r][\n]"
[2019-07-25 17:12:03,860] DEBUG - wire HTTP-Sender I/O dispatcher-12 << "Proxy-Authorization: Basic YWRtaW46YWRtaW4=[\r][\n]"
[2019-07-25 17:12:03,858] DEBUG - wire HTTP-Sender I/O dispatcher-3 << "Proxy-Authorizat
@menuka94
menuka94 / axis2.xml
Last active Apr 3, 2019
Netty Transport - WSO2 EI 6.4.0
View axis2.xml
<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?><!--
~ Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
~
~ WSO2 Inc. licenses this file to you under the Apache License,
~ Version 2.0 (the "License"); you may not use this file except
~ in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
@menuka94
menuka94 / README.md
Last active Feb 11, 2019 — forked from phillipgreenii/README.md
Running NPM Scripts through maven
View README.md

I am in the process of introducing single page applications to where I work. For development, using node based build tools is much easier for the single page applications. However, the build process for our organization is based upon maven. Our solution started with the maven plugin frontend-maven-plugin. It worked great at first, but then we ran into a situation that I couldn't make work with it.

As stated before, at our organization, we have the older ecosystem which is maven and the newer ecosystem which is node. Our goal was to keep the hacking to a minimum. We did this by putting all of the hacks into a single super node based build file. This is what maven calls and the reason frontend-maven-plugin wasn't sufficient. The super node based build script calls all of the other build scripts by spawning npm run. Try as I might, I could not figure out how to make the spawn work. front-end-maven-plugin downloads npm

View gist:dd44e9bf770052fd2fc745f127a99cba
sudo add-apt-repository -y ppa:ondrej/php
sudo apt-get update
sudo apt-get install -y php7.2-fpm
sudo apt-get install -y php7.2
sudo apt-get -y install curl php7.2-pgsql php7.2-curl php7.2-json php7.2-mbstring php7.2-gd php7.2-intl php7.2-xml php7.2-imagick php7.2-redis php7.2-zip
# sudo systemctl disable apache2
View cleanup-docker.sh
#!/bin/bash
# remove exited containers:
docker ps --filter status=dead --filter status=exited -aq | xargs -r docker rm -v
# remove unused images:
docker images --no-trunc | grep '<none>' | awk '{ print $3 }' | xargs -r docker rmi
# remove unused volumes:
find '/var/lib/docker/volumes/' -mindepth 1 -maxdepth 1 -type d | grep -vFf <(
View vue-data-binding-1.html
<!DOCTYPE html>
<html lang="en" xmlns:v-on="http://www.w3.org/1999/xhtml" xmlns:v-bind="http://www.w3.org/1999/xhtml">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>