Skip to content

Instantly share code, notes, and snippets.

View analyticalpicasso's full-sized avatar
🎯
Focusing

Sonam Sharma analyticalpicasso

🎯
Focusing
  • New Delhi, India
View GitHub Profile
import re
from collections import Counter
import spacy
from graph_show import GraphShow
import itertools
from collections import defaultdict
class NewsMining():
def score_docs(query, total_docs, offsets_compressed):
scores= [0]* total_docs
word_list = re.split("\\s+", query)
query_length = len(word_list)
for i in range(query_length):
if word_list[i] not in offsets_compressed:
del word_list[i]
@BCEvanFang
BCEvanFang / chaincode-ipfs-sample-code.go
Created November 9, 2018 01:00
A simple sample code for using IPFS in hyperledger fabric chaincode
package main
import (
"bytes"
"fmt"
"os"
"strings"
"github.com/hyperledger/fabric/core/chaincode/shim"
"github.com/hyperledger/fabric/protos/peer"
@slowkow
slowkow / remove-emoji.py
Created July 19, 2018 14:10
Remove all traces of emoji from a text file.
#!/usr/bin/env python
"""
Remove emoji from a text file and print it to stdout.
Usage
-----
python remove-emoji.py input.txt > output.txt
"""
@bradlucas
bradlucas / installing-get-on-centos.md
Created February 10, 2018 14:25
Installing Geth on Centos
$ sudo yum -y update
$ sudo yum -y install golang
$ sudo yum -y install gmp-devel
$ sudo yum -y install git
$ git clone https://github.com/ethereum/go-ethereum
$ cd go-ethereum/
$ make geth
$ ls -al build/bin/geth
@aparrish
aparrish / understanding-word-vectors.ipynb
Last active April 9, 2025 14:04
Understanding word vectors: A tutorial for "Reading and Writing Electronic Text," a class I teach at ITP. (Python 2.7) Code examples released under CC0 https://creativecommons.org/choose/zero/, other text released under CC BY 4.0 https://creativecommons.org/licenses/by/4.0/
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@greyli
greyli / app.py
Last active February 25, 2024 03:04
Photo upload and manage with Flask and Flask-Uploads (Multiple file upload support!).
# -*- coding: utf-8 -*-
import os
import uuid
from flask import Flask, render_template, redirect, url_for, request
from flask_uploads import UploadSet, configure_uploads, IMAGES, patch_request_class
from flask_wtf import FlaskForm
from flask_wtf.file import FileField, FileRequired, FileAllowed
from wtforms import SubmitField
@jvilledieu
jvilledieu / aml_demo.cql
Last active July 22, 2019 12:31
Import script for the aml demo
//Creating the companies
CREATE CONSTRAINT ON (a:COMPANY) ASSERT a.id IS UNIQUE;
USING PERIODIC COMMIT 2000
LOAD CSV WITH HEADERS FROM "file:///companies.csv" AS line
FIELDTERMINATOR ','
WITH line
MERGE (a:COMPANY {id: line.id})
ON CREATE SET a.description = line.description,
a.name = line.name;
@jonathanmorgan
jonathanmorgan / README.MD
Created July 1, 2016 12:48 — forked from aanastasiou/README.MD
Generate a Cypher query to store a Python Networkx directed graph

Exporting a Networkx graph as a Cypher query

This little project defines a function that can be used to construct a Cypher query which when executed against a Neo4j database server will store the graph to the server.

Background

  • A Graph is an abstract mathematical model composed of Nodes connected through Edges that can be used to describe complex systems composed of a set of parts (corresponding to nodes) and their connections (corresponding to edges).
  • Examples of graphs are road networks (junctions connected via roads), electronic circuit networks (components and their connections) and others
  • Networkx is an excellent Python module for manipulating such Graph objects of any kind.
  • Neo4j is a graph database. It uses the Graph as a data model to store such objects to a data store.
@tushortz
tushortz / UNICODE to ASCII python replace
Created April 6, 2016 22:14
Function to replace some annoying characters
def unicodetoascii(text):
TEXT = (text.
replace('\\xe2\\x80\\x99', "'").
replace('\\xc3\\xa9', 'e').
replace('\\xe2\\x80\\x90', '-').
replace('\\xe2\\x80\\x91', '-').
replace('\\xe2\\x80\\x92', '-').
replace('\\xe2\\x80\\x93', '-').
replace('\\xe2\\x80\\x94', '-').