Skip to content

Instantly share code, notes, and snippets.

View aswad32's full-sized avatar

Mohamad Aswad aswad32

  • Freelance
  • Kuala Lumpur
View GitHub Profile
LOAD CSV WITH HEADERS FROM "file:///offshore_leaks.nodes.address.csv" AS csvLine FIELDTERMINATOR ','
CREATE (p:offshoreLeaksKnownAddress {nodeId:csvLine.node_id, name:csvLine.node_id, address:csvLine.address,
countryCode:csvLine.country_codes, countries:csvLine.countries, sourceId:csvLine.sourceID,
validUntil:csvLine.valid_until, note:csvLine.note})
LOAD CSV WITH HEADERS FROM "file:///offshore_leaks.nodes.officer.csv" AS csvLine FIELDTERMINATOR ','
CREATE (p:offshoreLeaksOfficer {nodeId:csvLine.node_id, name:csvLine.name, countryCodes:csvLine.country_codes,
countries:csvLine.countries, sourceId:csvLine.sourceID, validUntil:csvLine.valid_until, note:csvLine.note})
db.[CollectionName].find().forEach(function(d){ db.getSiblingDB([Database])[CollectionName].insert(d); });
#Project Structure
MyCode
--MyCode.sln
--src
--MyCode.Common
--MyCode.WebApi
#Create Main Solution
> dotnet new sln --name MyCode
@aswad32
aswad32 / pandas-dataframe-insin.py
Created December 20, 2016 23:29
Python pandas dataframe isin and reverse isin
#isin
df.loc[df['kod'].isin([1,4])]
#reverse isin
df.loc[~df['kod'].isin([2,3])]
@aswad32
aswad32 / moving-tempdb-sqlserver.sql
Last active December 20, 2016 23:29
Moving SQL Server tempdb to another drive
use master
go
alter database tempdb modify file (Name=tempdev, filename='D:\SQLServer\tempdb.mdf')
go
alter database tempdb modify file (Name=templog, filename='D:\SQLServer\templog.ldf')
go
@aswad32
aswad32 / ElasticSearch5-Kibana-xpack
Created November 15, 2016 23:09
Installing ElasticSearch 5.0.0, Kibana 5.0.1 and X-Pack with Homebrew
#install elasticsearch (this will install elasticsearch as a services and automatically start after installation done)
brew install elasticsearch
#install x-pack plugin for elasticsearch
elasticsearch-plugin install x-pack
#download kibana from https://www.elastic.co/products/kibana
copy the archive to some where that can easily accessible
#install x-pack for kibana (change directory to kibana bin directory)
After done with installation process, open terminal as administrator and change to 'mongodb bin' directory in my case it would be C:\Program Files\MongoDB\Server\3.2\bin and run the following command
mongod.exe --dbpath=D:\mongodb --logpath=D:\mongolog\log.txt --install
--dbpath -specify the path name where mongodb should store the data
--logpath -specify the path for any log related to mongodb
At least those 2 parameters should be included inside the command line argument
To check either the service started or not, in the terminal, type the following command
> mongo.exe
/*
Mongodb aggregrate function to do the following task:
1. date formatting ($project)
2. match condition
3. sort
4. limit
article schema
{