Skip to content

Instantly share code, notes, and snippets.

View hernamesbarbara's full-sized avatar

austin hernamesbarbara

View GitHub Profile
import numpy as np
import pandas as pd
def make_random_dataframe(ncol, nrow):
"return a random dataframe suitable for simulating a linear regression"
from string import ascii_lowercase as letters
from sklearn.datasets import make_regression
columns = list(letters[:ncol])
X, y = make_regression(n_features=ncol-1, n_samples=nrow, n_targets=1, n_informative=4)
y = y.reshape(X.shape[0], 1)
Select me then press 'Highlight' button below.
<br>
<br>
<input type="button" value="Highlight" onclick="highlight('yellow');">
<script>
function makeEditableAndHighlight(colour) {
sel = window.getSelection();
if (sel.rangeCount && sel.getRangeAt) {
@hernamesbarbara
hernamesbarbara / Default (OSX).sublime-keymap
Last active June 5, 2017 22:34
Macro to convert selected lines of text into a comma separated list
[{
{
"keys": ["super+,", "super+,"],
"command": "run_macro_file",
"args": {
"file": "Packages/User/add-commas.sublime-macro"
}
}]
@hernamesbarbara
hernamesbarbara / jupyter.py
Created May 21, 2017 01:55
Custom thefuck rule for Jupyter commands
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""jupyter.py - Custom `nvbn/thefuck` rule for fixing typos in Jupyter commands
Rule should go here: ~/.config/thefuck/rules/jupyter.py
More on github: https://github.com/nvbn/thefuck
Example:
$ jupyter notebok
#!/usr/bin/env bash
# -*- coding: utf-8 -*-
say "ay dont reelly know donde ay go a next.. Pero, ayem pritty exayted abowwt et.."\
-v Carlos -o "baxter-es.m4a" --data-format=alac
#!/usr/bin/env bash
# -*- coding: utf-8 -*-
# use t CLI to fetch follower count and other stats from twitter
# save results to a csv file
if [ -z "$1" ]; then
echo "no username specified" >&2
exit 1
else

Principles of Adult Behavior

  1. Be patient. No matter what.
  2. Don’t badmouth: Assign responsibility, not blame. Say nothing of another you wouldn’t say to him.
  3. Never assume the motives of others are, to them, less noble than yours are to you.
  4. Expand your sense of the possible.
  5. Don’t trouble yourself with matters you truly cannot change.
  6. Expect no more of anyone than you can deliver yourself.
  7. Tolerate ambiguity.
  8. Laugh at yourself frequently.

Keybase proof

I hereby claim:

  • I am hernamesbarbara on github.
  • I am hernamesbarbara (https://keybase.io/hernamesbarbara) on keybase.
  • I have a public key whose fingerprint is 8D83 4863 3195 7A45 4D2C 9BEF BE6B 90F3 C6E1 8518

To claim this, I am signing this object:

#!/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)
@hernamesbarbara
hernamesbarbara / select_star_in_salesforce_apex.cls
Created November 20, 2014 22:47
Salesforce won't let you select star (SELECT *). This is a workaround where you generate the SOQL manually by inspecting the schema of the 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());