Skip to content

Instantly share code, notes, and snippets.

@guotechfin
guotechfin / useful_pandas_snippets.py
Last active February 24, 2018 13:03 — forked from bsweger/useful_pandas_snippets.md
Useful Pandas Snippets
# List unique values in a DataFrame column
# h/t @makmanalp for the updated syntax!
df['Column Name'].unique()
# Convert Series datatype to numeric (will error if column has non-numeric values)
# h/t @makmanalp
pd.to_numeric(df['Column Name'])
# Convert Series datatype to numeric, changing non-numeric values to NaN
# h/t @makmanalp for the updated syntax!
@guotechfin
guotechfin / jupyter_shortcuts.md
Created November 9, 2016 03:14 — forked from kidpixo/jupyter_shortcuts.md
Keyboard shortcuts for ipython notebook 3.1.0 / jupyter

Toc

Keyboard shortcuts

The IPython Notebook has two different keyboard input modes. Edit mode allows you to type code/text into a cell and is indicated by a green cell border. Command mode binds the keyboard to notebook level actions and is indicated by a grey cell border.

MacOS modifier keys:

  • ⌘ : Command
@guotechfin
guotechfin / kafka_install.md
Created July 14, 2016 05:30 — forked from leommoore/kafka_install.md
Kafka - Messaging Basics

#Kafka - Messaging Basics This assumes you are starting fresh and have no existing Kafka or ZooKeeper data. See http://kafka.apache.org/documentation.html#quickstart for more details.

##Install Java

sudo apt-get install python-software-properties
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer
@guotechfin
guotechfin / ssl.sh
Last active December 3, 2015 05:06
#generate csr
openssl req -new -key xxx.pem -out xxx.csr
#show content
openssl req -in yyy.csr -noout -text
#link
##https://www.sslshopper.com/article-most-common-openssl-commands.html
#tomcat
1. Import the appropriate root certificates using:
// This script will boot app.js with the number of workers
// specified in WORKER_COUNT.
//
// The master will respond to SIGHUP, which will trigger
// restarting all the workers and reloading the app.
var cluster = require('cluster');
var workerCount = process.env.WORKER_COUNT || 2;
// Defines what each worker needs to run
@guotechfin
guotechfin / mongodb.sh
Last active August 29, 2015 14:24 — forked from mrrooijen/mongodb.sh
# Downloads MongoDB Version 1.2.2 to the Home Dir
# Extracts it and moves the contents into the /var/mongodb folder
# Creates a symlink from /var/mongodb/mongod to /usr/local/sbin
cd ~/
wget http://downloads.mongodb.org/linux/mongodb-linux-x86_64-1.2.2.tgz
tar -xf mongodb-linux-x86_64-1.2.2.tgz
mkdir -p /var/mongodb
mv mongodb-linux-x86_64-1.2.2/* /var/mongodb/
ln -nfs /var/mongodb/bin/mongod /usr/local/sbin
var app = angular.module('app', ['ngResource']);
app.config(function($locationProvider, $routeProvider) {
// $locationProvider.html5Mode(true);
$routeProvider
.when('/', { templateUrl: 'partials/index', controller: 'ctrl' })
.when('/about', { templateUrl: 'partials/about', controller: 'ctrl' })
.otherwise({redirectTo:'/'});
});
exports.ensureAuthenicated = function(req, res, next) {
if (req.isAuthenticated()) { return next(); }
res.redirect('/login')
}