Using numpy to build an array of all combinations of two arrays
Cartesian product function by Stackoverflow user, pv.
See Answer here.
| #!/usr/bin/env python | |
| # -*- coding: utf-8 -*- | |
| """atbash.py | |
| """ | |
| from string import letters | |
| def atbash(txt): | |
| sub_table = zip(letters[:26], "".join(reversed(letters[:26]))) | |
| sub_table += zip(letters[26:], "".join(reversed(letters[26:]))) | |
| sub_table = dict(sub_table) |
| Map<String, Schema.SObjectField> field_objmap = schema.SObjectType.Opportunity.fields.getMap(); | |
| List<Schema.SObjectField> field_objmap_values = field_objmap.values(); | |
| List<String> field_names_list = new List<String>(); | |
| for(Schema.SObjectField s : field_objmap_values) { | |
| String field_label = String.valueOf(s.getDescribe().getLabel()); // Perhaps store this in another map | |
| String field_name = String.valueOf(s.getDescribe().getName()); | |
| String field_type = String.valueOf(s.getDescribe().getType()); | |
| #!/usr/bin/osascript | |
| (* subroutine to bring an application to front. | |
| you could invoke it from an alias in your | |
| ~/.bash_profile, another script or an alfred workflow | |
| *) | |
| property default_app : "" | |
| on bring_to_front(app_name) | |
| set res to false |
| #!/usr/bin/env python | |
| # -*- coding: utf-8 -*- | |
| import pandas as pd | |
| sample = """user_id,website 1 name,website 1 value,website 2 name,website 2 value,website 3 name,website 3 value | |
| '000001,linkedin,https://linkedin.com/245563,github,https://github.com/926850,, | |
| '000002,facebook,https://facebook.com/976099,,,, | |
| '000003,twitter,https://twitter.com/612711,,,linkedin,https://linkedin.com/840609 | |
| '000004,github,https://github.com/220993,blog,https://blog.com/201188,linkedin,https://linkedin.com/479351 | |
| '000005,,,twitter,https://twitter.com/897816,, |
Using numpy to build an array of all combinations of two arrays
Cartesian product function by Stackoverflow user, pv.
See Answer here.
| #!/bin/bash | |
| echo COCKTAIL GLASS > drinks.txt | |
| echo -e "\xf0\x9f\x8d\xb8" >> drinks.txt | |
| echo TROPICAL DRINK >> drinks.txt | |
| echo -e "\xf0\x9f\x8d\xb9" >> drinks.txt | |
| echo BEER MUG >> drinks.txt | |
| echo -e "\xf0\x9f\x8d\xba" >> drinks.txt |
| var _ = require('underscore'); | |
| function simple_linear_regression (x, y) { | |
| var sum_x = 0 | |
| , sum_y = 0 | |
| , sum_xy = 0 | |
| , sum_xx = 0 | |
| , cnt = 0 | |
| , nrow = x.length | |
| , m = null |
| [ | |
| { | |
| "keys": [ | |
| "alt+minus" | |
| ], | |
| "command": "insert", | |
| "args": { | |
| "characters": " <- " | |
| }, | |
| "context": [ |