Lecture 1: Introduction to Research — [📝Lecture Notebooks] [
Lecture 2: Introduction to Python — [📝Lecture Notebooks] [
Lecture 3: Introduction to NumPy — [📝Lecture Notebooks] [
Lecture 4: Introduction to pandas — [📝Lecture Notebooks] [
Lecture 5: Plotting Data — [📝Lecture Notebooks] [[
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
from collections import defaultdict | |
from typing import Type, cast, Callable, TypeVar, Any | |
from functools import wraps | |
T = TypeVar('T') | |
def wrap_setattr(definition: dict, fn: Callable) -> Callable: | |
@wraps(fn) | |
def wrapped(self, attr, value): |
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
function sleep(n) { | |
Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, n*1000); | |
} |
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
grep -rl "oldstring" . | LANG=C LC_ALL=C xargs sed -i '' -e "s/oldstring/newstring/g" |
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 cgi | |
import requests | |
import json | |
from simple_salesforce import Salesforce | |
#login here: | |
#https://login.salesforce.com/services/oauth2/authorize?response_type=code&client_id=3MVG9A2kN3Bn17hsWsLDatw._IVMEUBoPKv.7ksp0tz7xLX4tWDVgyzwTCA7i_yTfP.qYuNOsSoPNcdVH6DuE&redirect_uri=http://localhost/cgi-bin/python/oauth.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
#!/bin/sh | |
sudo echo "export NEO4J_HOME=/opt/neo4j" >> /etc/environment | |
source /etc/environment | |
sudo mkdir -p $NEO4J_HOME | |
sudo chown ubuntu.ubuntu $NEO4J_HOME | |
cd /tmp |
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 time | |
import random | |
import requests | |
from profilehooks import profile | |
def timeit(method): | |
def timed(*args, **kw): | |
ts = time.time() |
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
weekdays = ('Monday', 'Tuesday', 'Wednesday', | |
'Thursday', 'Friday', 'Saturday', 'Sunday', ) | |
def convert_choice(*args): | |
"""Convert weekdays representation to 127 bits | |
Example: | |
>> # Monday, Tuesday, Friday, Sunday | |
>> bw.convert(1, 1, 0, 0, 1, 0, 1) |
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
#!/bin/bash | |
### USAGE | |
### | |
### ./ElasticSearch.sh 1.7 will install Elasticsearch 1.7 | |
### ./ElasticSearch.sh will fail because no version was specified (exit code 1) | |
### | |
### CLI options Contributed by @janpieper | |
### Check http://www.elasticsearch.org/download/ for latest version of ElasticSearch |
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
grep -F -x -v -f <file to compare:file B>.txt <base file:file A>.txt | |
# or: | |
comm <(sort fileB) <(sort fileA) -3 > output.txt | |
# prints lines that are both in file1 and file2 (intersection) | |
awk 'NR==FNR{a[$0];next} $0 in a' file1 file2 |
NewerOlder