This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // The above is courtesy of @moldy via #django (freenode) | |
| frameworks: | |
| Django, flask, Werkzeug, Cherrypy, Rails | |
| languages: | |
| Ruby, Python | |
| WSGI servers: | |
| gunicorn, uWSGI, apache (with mod_wsgi) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| if not os.path.exists(os.path.dirname(filename)): | |
| try: | |
| os.makedirs(os.path.dirname(filename)) | |
| except OSError as exc: # protects against race conds | |
| if exc.errno != errno.EEXIST: | |
| printToLog("Failed to make the directory!",1) | |
| raise | |
| with open(filename,"w") as f: | |
| for chunk in res.iter_content(2**20): | |
| f.write(chunk) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| \documentclass{article} | |
| \newenvironment{env}[2]{env is #1 and #2}{} | |
| \begin{document} | |
| \begin{env}{amazing, wonderful} | |
| \end{env} | |
| \end{document} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ```diff,python | |
| def foo(): | |
| - a = 0 | |
| + a = 1 | |
| return | |
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| set nocompatible | |
| filetype plugin on | |
| set rtp=$HOME/vimfiles/bundle/vimtex | |
| set rtp+=$HOME/vimfiles/bundle/vimtex/after | |
| let g:vimtex_view_general_viewer='SumatraPDF' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| DATE=`date +%Y-%m-%d--%H:%M:%S`; | |
| ZNCCLEANDIR=/home/john/znc_clean; | |
| ZNCLOGDIR=/home/john/.znc/users/fuzzybear3965/networks/lovelace_freenode/moddata/log; | |
| MESSAGESFILENAMERELATIVE="messages_$DATE.log"; | |
| OLDLOGSFILENAMERELATIVE="oldlogs_$DATE.log"; | |
| MESSAGESFILENAME=$ZNCCLEANDIR/$MESSAGESFILENAMERELATIVE; | |
| OLDLOGSFILENAME=$ZNCCLEANDIR/$OLDLOGSFILENAMERELATIVE; | |
| if [ -f $MESSAGESFILENAME ]; then |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var Promise = require("bluebird"); | |
| var bhttp = require("bhttp"); | |
| var taskQueue = require("promise-task-queue"); | |
| var MongoClient = require('mongodb'); | |
| var queue = taskQueue(); | |
| var failedRequests = 0; | |
| //const alphabet = "abcdefghijklmnopqrstuvwxyz" | |
| //const urls =[] | |
| //for (let i=0 ; i < 4; i++) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import motor.motor_asyncio | |
| import asyncio | |
| client = motor.motor_asyncio.AsyncIOMotorClient('localhost', 27017) | |
| db = client['testDB'] | |
| async def do_insert(user, collection_name): | |
| document = {'user': user} | |
| result = await db[collection_name].insert_one(document); | |
| print('Added user %s' % user) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Plots | |
| Plots.plotly() | |
| function f(B) | |
| return function (a,b) | |
| (2/pi)*( | |
| 2*e^(-2*(a^2+b^2))*cos(4*b*B) | |
| + | |
| e^(-2*((a+B)^2+b^2))*(1+e^(8*a*B)) | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @sync @parallel for i = 1:length(x) | |
| for j = 1:length(y) | |
| grid[i,j] = | |
| Cubature.hcubature(integrand(3,x[i],y[j]),[1e-2,0],[10,2*pi])[1] | |
| end | |
| end |
OlderNewer