Skip to content

Instantly share code, notes, and snippets.

View saurabhvyas's full-sized avatar

Saurabh Vyas saurabhvyas

  • India
View GitHub Profile
from __future__ import print_function
from flask import Flask, request, jsonify
from flask_cors import CORS
import tensorflow as tf
#from tensorflow.contrib import rnn
import numpy as np
import scipy.io.wavfile as wav
@saurabhvyas
saurabhvyas / clean.sh
Last active February 21, 2018 08:19
will clean up your UTF-8 file, skipping all the invalid characters.
#!/bin/bash
# this script removes invalid utf-8 codes from a bunch of text files in input_dir
input_dir='/media/saurabh/New Volume2/hardik_dataset/final (another copy)'
output_dir='/media/saurabh/New Volume2/hardik_dataset/output'
# iterate over each file in input folder
@saurabhvyas
saurabhvyas / wiki_resume
Created December 1, 2017 10:31
wiki_resume
in_file = "/media/saurabh/New Volume/Untitled Folder/final.txt"
out_file = "/media/saurabh/New Volume/Untitled Folder/final_out.txt"
replacement = dict([(cp, cp.replace(' ', '_')) for cp in concepts])
with open(in_file) as infile, open(out_file, 'a') as file:
for index,line in enumerate(infile):
for concept_phrase in concepts:
line = line.replace(concept_phrase, replacement[concept_phrase])
file.write(line + '\n' )
# coding: utf-8
# In[ ]:
# In[1]:
// need to iterate over each wikipedia article raw text
var wtf_wikipedia = require("wtf_wikipedia")
fs = require('fs');
path = require('path');
var final_str=""
@saurabhvyas
saurabhvyas / file.js
Created August 23, 2017 12:03
node.js file that converts each .txt in a folder having wikitext to new .txt in a new folder which has plaintext
// need to iterate over each wikipedia article raw text
var wtf_wikipedia = require("wtf_wikipedia")
fs = require('fs');
path = require('path');
var final_str=""
@saurabhvyas
saurabhvyas / apache_config
Last active August 4, 2017 04:50
nginx config file
# This is the main Apache server configuration file. It contains the
# configuration directives that give the server its instructions.
# See http://httpd.apache.org/docs/2.4/ for detailed information about
# the directives and /usr/share/doc/apache2/README.Debian about Debian specific
# hints.
#
#
# Summary of how the Apache 2 configuration works in Debian:
# The Apache 2 web server configuration in Debian is quite different to
# upstream's suggested way to configure the web server. This is because Debian's
var server = require("net").createServer(function(c) {
// A new client as connected
c.write("Hello");
c.on('data', function(data) {
console.log(">"+JSON.stringify(data));
});
c.end();
});
server.listen(9000);
#
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x00007f6da5c59009, pid=14957, tid=14986
#
# JRE version: OpenJDK Runtime Environment (9.0) (build 9-internal+0-2016-04-14-195246.buildd.src)
# Java VM: OpenJDK 64-Bit Server VM (9-internal+0-2016-04-14-195246.buildd.src, mixed mode, tiered, compressed oops, g1 gc, linux-amd64)
# Problematic frame:
# C [libjava.so+0x1d009] JNU_GetEnv+0x19
#
---
###############################################################################
# Pro-tips:
#
# - Use YAML's anchors! This let's you define a value (even a dictionary), and
# reuse, or even change, parts of it later. YAML anchors are incredible for
# defining constant values that you want to reuse all over the place. You can
# define an anchor like this:
# KEY: &my_anchor