Skip to content

Instantly share code, notes, and snippets.

View wwj718's full-sized avatar

wwj718

View GitHub Profile
@jagt
jagt / expr.py
Created January 18, 2014 18:00
simple math expr parser. pratt parser really rocks.
# simple math expression pratt parser
def lexer(s):
'''token generator'''
ix = 0
while ix < len(s):
if s[ix].isspace(): ix += 1
elif s[ix] in "+-*/()":
yield s[ix]; ix += 1
elif s[ix].isdigit():
@wwj718
wwj718 / client.py
Created March 24, 2017 11:37 — forked from marvin/client.py
simple python client/server socket binary stream
import socket
HOST = 'localhost'
PORT = 9876
ADDR = (HOST,PORT)
BUFSIZE = 4096
videofile = "videos/royalty-free_footage_wien_18_640x360.mp4"
bytes = open(videofile).read()
@sgoblin
sgoblin / rhubarbot.py
Created December 22, 2016 21:00
JimTheBot from rhubarb.sgoblin.com
from chatterbot import ChatBot
from chatterbot.trainers import ChatterBotCorpusTrainer
import websocket
from time import sleep
import json
# Insert database name here
db_name="jimdb"
# Insert valid database URI here
version: '3'
services:
postgres:
image: postgres:9.4-alpine
volumes:
- ./pgdata_new:/var/lib/postgresql/data
ports:
- '127.0.0.1:5432:5432'
elasticsearch:
#image: wwj2
@wwj718
wwj718 / 一些CDN公共库.md
Last active September 19, 2018 03:22
一些CDN公共库,常用的js,css公共库

#说明:

  • google的公共库国内访问不稳定
  • 与将JS库存放在服务器单机上相比,CDN公共库更加稳定、高速。

##百度公共库

  • [地址](http://developer.baidu.com/wiki/index.php?title=docs/cplat/libs)
  • 百度公共CDN为您的应用程序提供稳定、可靠、高速的服务,包含全球所有最流行的开源JavaScript库
  • 如果对版本要求不严,百度的公共库的确提供了一个很好的解决方案,不管从速度和稳定性方面都不错
  • 百度CDN最明显的优势就是速度快
* http://codecombat.com/
* https://www.codeavengers.com/
* https://scratch.mit.edu/projects/editor/?tip_bar=hoc
* https://www.tynker.com/
* http://lightbot.com/
* https://codehs.com/
* https://code.org/learn
* http://freecodecamp.com/
@moustaki
moustaki / Faster save-load for word2vec
Created February 19, 2014 12:37
Faster save-load for word2vec
import dbm, os
import cPickle as pickle
from gensim.models import Word2Vec
import numpy as np
def save_model(model, directory):
model.init_sims() # making sure syn0norm is initialised
if not os.path.exists(directory):
os.makedirs(directory)
# Saving indexes as DBM'ed dictionary
@littlecodersh
littlecodersh / flask_qr.py
Created December 5, 2016 01:22
A demo of how to show itchat qrcode through website.
import threading
from flask import Flask, make_response
import itchat
qrSource = ''
def start_flask():
flaskApp = Flask('itchat')
@flaskApp.route('/')
@jubos
jubos / gist:2409369
Created April 17, 2012 22:02
s3cmd config for Fake S3
[default]
access_key = asf
bucket_location = US
cloudfront_host = cloudfront.amazonaws.com
cloudfront_resource = /2010-07-15/distribution
default_mime_type = binary/octet-stream
delete_removed = False
dry_run = False
encoding = UTF-8
encrypt = False
@me00016
me00016 / COZMO conversing using ChatterBot 0.7.6
Last active August 14, 2020 20:16
COZMO conversing using ChatterBot 0.7.6
#!/usr/bin/env python3
# Copyright (c) 2016 Anki, Inc. (except Chatterbot part and a couple of my
# own lines of code)
#
# Licensed 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 in the file LICENSE.txt or at
#
# http://www.apache.org/licenses/LICENSE-2.0