Skip to content

Instantly share code, notes, and snippets.

void Main()
{
///Understanding Captures vs Groups http://stackoverflow.com/a/3320890/1175496
//In short, Groups represent things inside Grouping Parentheses ()
//Captures represent the items in the collection implied by repetition operators * and +
var matchesONE = Regex.Matches("{Q}{R}{S}", @"(\{[A-Z]\})");
var matchesOOM = Regex.Matches("{Q}{R}{S}", @"(\{[A-Z]\})+");
var matchesOPT = Regex.Matches("{Q}{R}{S}", @"(\{[A-Z]\})*");
Console.Out.WriteLine(matchesONE);
@theredpea
theredpea / ModifyingWhileIterating.linq
Created May 16, 2014 20:22
ModifyingWhileIterating
//I couldn't figure out why I modified a List but later in the code the List seemed unchanged.
//I was modifying something returned the public accessor { get };
//But wasn't truly changing the private variable behind the public variable
//Again I ran into it while trying to fix TT0263356
void Main()
{
List<List<Ref>> Refss = new List<List<Ref>>{
new List<Ref> {
function drawVisualization() {
var data = google.visualization.arrayToDataTable([
['Country', 'Popularity', 'Display'],
['DE-BY', 200, 'Bavaria'],
['DE-NW', 500, 'Nordrhein-Westfalen']
]);
//http://stackoverflow.com/a/11956132/1175496
var formatter = new google.visualization.PatternFormat('{1}');
formatter.format(data, [0,2]);
filepath = r'\\path\to\file\may\not\be\a\PNG.png'
filepath.replace('\\', '/')
f = open(filepath, mode='b')
b = f.read(8)
for _ in b:
print (_)
print (hex(_))
#Notice the first two hex values are 42 and 4d;
#Consistent with BMP filetype (despite the extension),
import base64
file_path = r'\\useomapp2100.us.kworld.kpmg.com\Showcase App\Logos\kpmg_logo_from_qvt_qlikview_extension_downsized_sharp.png'
with (open(file_path, 'rb') as f):
b = f.read()
encoded_string = base64.b64encode(b)
@theredpea
theredpea / roll_ipython_in_aws.md
Last active March 26, 2017 19:10 — forked from iamatypeofwalrus/roll_ipython_in_aws.md
Adding summary, preparing to update screenshots per latest Amazon UI

What

Roll your own iPython Notebook server with Amazon Web Services (EC2) using their Free Tier.

What are we using? What do you need?

  • An active AWS account. First time sign-ups are eligible for the free tier for a year
  • One Micro Tier EC2 Instance
  • With AWS we will use the stock Ubuntu Server AMI and customize it.
  • Anaconda for Python.
  • Coffee/Beer/Time
--SETUP
DECLARE @test_xml_table TABLE (test_xml_column xml);
DECLARE @test_xml_local_variable xml;
SET @test_xml_local_variable = '<?xml version="1.0" encoding="utf-8"?>
<Countries>
<Country >
<CountryName>US</CountryName>
<IncomeStatements>
@theredpea
theredpea / .block
Last active November 15, 2020 00:50
nate central limit theorem demo
license: mit
height: 2000
scrolling: yes
@theredpea
theredpea / .block
Last active August 30, 2016 03:05
ranged charts
license: mit
height: 2000
scrolling: yes
#!/bin/bash
echo "Current working directory '$(pwd)'"
echo "Writing the log files to one directory *above* $(pwd) so that changes to the log files aren't noticed by the Google App Engine"
read -p "Press [Enter] key to run python exe dev_appserver.py pointed at ttbtamer folder"
"C:/Program Files (x86)/Google/Cloud SDK/google-cloud-sdk/platform/bundledpython/python.exe" "C:/Program Files (x86)/Google/Cloud SDK/google-cloud-sdk/bin/dev_appserver.py" . 1>>../out.log 2>>../err.log