This file contains 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
# Create a new repository on the command line | |
touch README.md | |
git init | |
git add README.md | |
git commit -m "first commit" | |
git remote add origin https://github.com/c0ldlimit/vimcolors.git | |
git push -u origin master | |
# Push an existing repository from the command line |
This file contains 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
sudo apt update | |
sudo apt upgrade | |
# https://www.digitalocean.com/community/tutorials/how-to-create-a-new-sudo-enabled-user-on-ubuntu-22-04-quickstart | |
# https://support.atlassian.com/bitbucket-cloud/docs/set-up-personal-ssh-keys-on-linux/ | |
# https://docs.conda.io/en/main/miniconda.html | |
# Setting up Ubuntu | |
# check locale |
This file contains 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
# http://flask.pocoo.org/snippets/88/ | |
import os, sqlite3 | |
from cPickle import loads, dumps | |
from time import sleep | |
try: | |
from thread import get_ident | |
except ImportError: | |
from dummy_thread import get_ident |
This file contains 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 numpy as np | |
x = array([3,4,None,55]) | |
y = np.array(x,dtype=float) | |
# OR | |
y = np.array(x) | |
z = y.astype(float) |
This file contains 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
# This example passes one formal (positional) argument, and two more variable length arguments. | |
def test_var_args(farg, *args): | |
print "formal arg:", farg | |
for arg in args: | |
print "another arg:", arg | |
test_var_args(1, "two", 3) | |
# Here is an example of how to use the keyworded form. Again, one formal argument and two keyworded variable arguments are passed. | |
def test_var_kwargs(farg, **kwargs): |
This file contains 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 StringIO | |
from flask import Flask, Response | |
@app.route('/some_dataframe.csv') | |
def output_dataframe_csv(): | |
output = StringIO.StringIO() | |
some_dataframe.to_csv(output) |
This file contains 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
' http://stackoverflow.com/questions/12856979/how-to-refresh-load-rtd-bloomberg-function-bdh-in-excel-in-vba | |
Application.run "RefreshAllWorkbooks" | |
Application.run "RefreshAllStaticData" |
This file contains 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
# http://stackoverflow.com/questions/19112296/how-to-pass-arguments-from-tornado-to-a-js-file-but-not-html | |
$ tree | |
. | |
├── static | |
│ └── scripts | |
│ └── test.js | |
├── templates | |
│ └── index.html | |
└── test.py |
This file contains 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 os | |
import random | |
from scrapy.conf import settings | |
class RandomUserAgentMiddleware(object): | |
def process_request(self, request, spider): | |
ua = random.choice(settings.get('USER_AGENT_LIST')) | |
if ua: | |
request.headers.setdefault('User-Agent', ua) | |
class ProxyMiddleware(object): |
This file contains 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
#!/usr/bin/python | |
import httplib | |
import socks | |
import urllib2 | |
from Queue import Queue | |
from threading import Thread, Condition, Lock | |
from threading import active_count as threading_active_count | |
import time |
NewerOlder