Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View sarchak's full-sized avatar

Shrikar Archak sarchak

View GitHub Profile
from flask import Flask, render_template
from flask_sock import Sock
import json
from great_things import audio
app = Flask(__name__)
app.config["SOCK_SERVER_OPTIONS"] = {"ping_interval": 25}
sock = Sock(app)
const WebSocket = require("ws");
const express = require("express");
const WaveFile = require("wavefile").WaveFile;
const axios = require("axios");
const fs = require("fs");
const ffmpeg = require("fluent-ffmpeg");
const path = require("path");
const app = express();
const server = require("http").createServer(app);
parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcelRequire,u="function"==typeof require&&require;function f(t,n){if(!r[t]){if(!e[t]){var i="function"==typeof parcelRequire&&parcelRequire;if(!n&&i)return i(t,!0);if(o)return o(t,!0);if(u&&"string"==typeof t)return u(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[t][1][r]||r},p.cache={};var l=r[t]=new f.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return r[t].exports;function p(e){return f(p.resolve(e))}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=r,f.parent=o,f.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]};for(var c=0;c<t.length;c++)try{f(t[c])}catch(e){i||(i=e)}if(t.length){var l=f(t[t.length-1]);"object"==typeof exports&&"undefined"!=typeof module?module.exports=l:"function"==typeof define&&define.amd?define(function(){return l}):n&&(this[n]=l)}if(parcelRequire=f,i)throw i;return f}({
parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcelRequire,u="function"==typeof require&&require;function f(t,n){if(!r[t]){if(!e[t]){var i="function"==typeof parcelRequire&&parcelRequire;if(!n&&i)return i(t,!0);if(o)return o(t,!0);if(u&&"string"==typeof t)return u(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[t][1][r]||r},p.cache={};var l=r[t]=new f.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return r[t].exports;function p(e){return f(p.resolve(e))}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=r,f.parent=o,f.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]};for(var c=0;c<t.length;c++)try{f(t[c])}catch(e){i||(i=e)}if(t.length){var l=f(t[t.length-1]);"object"==typeof exports&&"undefined"!=typeof module?module.exports=l:"function"==typeof define&&define.amd?define(function(){return l}):n&&(this[n]=l)}if(parcelRequire=f,i)throw i;return f}({
body{margin:0;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Roboto","Oxygen","Ubuntu","Cantarell","Fira Sans","Droid Sans","Helvetica Neue",sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}code{font-family:source-code-pro,Menlo,Monaco,Consolas,"Courier New",monospace}
{
// "profile":true,
"query": {
"bool": {
"should": [
{
"bool": {
"filter": [
{
"term": {
We can't make this file beautiful and searchable because it's too large.
rid,aid,overall
176008,0,5.0
173739,0,1.0
134504,0,3.0
24476,0,2.0
57419,0,1.0
79045,1,5.0
86474,1,2.0
157218,1,5.0
162834,1,4.0
We can't make this file beautiful and searchable because it's too large.
rid aid overall
176008 0 5.0
173739 0 1.0
134504 0 3.0
24476 0 2.0
57419 0 1.0
79045 1 5.0
86474 1 2.0
157218 1 5.0
162834 1 4.0
This file has been truncated, but you can view the full file.
rid aid overall
176008 0 5.0
173739 0 1.0
134504 0 3.0
24476 0 2.0
57419 0 1.0
79045 1 5.0
86474 1 2.0
157218 1 5.0
162834 1 4.0
We can't make this file beautiful and searchable because it's too large.
post,tags
conventions of importing python main programs often i write command line utilities that are only meant to be run as main. for example i might have a file that looks like this: <pre><code>#!/usr/bin/env python if __name__ == __main__ : import sys # do stuff </code></pre> in other words there is nothing going on that isn t under the if statement checking that this file is being run as main. i tried importing a file like this to see what would happen and the import was successful. so as i expected one is allowed to import files like this but what is the convention surrounding this practice is one supposed to throw an error telling the user that there is nothing to be imported or if all the contents of the file are supposed to be run as main does one need to check if the program is being run as main or is the conditional not necessary also if i have import statements should they be at the top of the file or under the conditional if the modules are only being used unde