Skip to content

Instantly share code, notes, and snippets.

@swegner
swegner / gist:37a9aab219d11c9dccf5a181947aad69
Last active September 20, 2018 15:53
git fetch one week of commits apache/beam
> git init
Initialized empty Git repository in /usr/local/google/home/swegner/scratch/beam-clone/.git/
> git remote add origin https://github.com/apache/beam.git
> git remote add swegner https://github.com/swegner/beam.git
> time git fetch swegner one-week-ago
remote: Counting objects: 266824, done.
remote: Compressing objects: 100% (2/2), done.
@swegner
swegner / gist:3e065b2ac4ee0f1ebb53bfd896bafbcd
Last active September 20, 2018 15:38
git fetch one week of commits apache/beam-site
> git init
Initialized empty Git repository in /usr/local/google/home/swegner/scratch/beam-site-clone/.git/
> git remote add origin https://github.com/apache/beam-site.git
> git remote add swegner https://github.com/swegner/beam-site.git
> time git fetch swegner one-week-ago
remote: Counting objects: 43284, done.
remote: Compressing objects: 100% (13/13), done.
@swegner
swegner / gist:b1a6f26a937390b0afbadd9dce3f2f3e
Created September 20, 2018 15:26
apache/beam-site full clone timing
> time git clone https://github.com/apache/beam-site.git .
Cloning into '.'...
remote: Counting objects: 43337, done.
remote: Compressing objects: 100% (34/34), done.
remote: Total 43337 (delta 38), reused 54 (delta 33), pack-reused 43269
Receiving objects: 100% (43337/43337), 73.35 MiB | 21.67 MiB/s, done.
Resolving deltas: 100% (33037/33037), done.
Checking out files: 100% (26933/26933), done.
real 0m7.982s
@swegner
swegner / migrate_beamsite.sh
Last active September 19, 2018 19:21
Script to automate migration of apache/beam-site into apache/beam. https://issues.apache.org/jira/browse/BEAM-4494
#!/bin/bash
SITE_BRANCH=website-migration-beamsite
BEAM_BRANCH=website-migration
WEBSITE_UPSTREAM=upstream-site/asf-site
# WEBSITE_UPSTREAM=swegner-site/apache_headers
cd ~/beam
git reset --hard
git clean -fdx
@swegner
swegner / generated-pom.xml
Created April 5, 2018 17:33
Sample generated POM
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.beam</groupId>
<artifactId>beam-examples-java</artifactId>
<version>2.5.0-SNAPSHOT</version>
<packaging>pom</packaging>
<name>Apache Beam :: Examples :: Java</name>
<description>Apache Beam :: Examples :: Java</description>
<url>http://beam.apache.org</url>
@swegner
swegner / GenericPipelineOptions.java
Created October 21, 2016 22:44
Testing PipelineOptions builder syntax using self-referencing generics
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
@RunWith(JUnit4.class)
public class GenericPipelineOptions {
public interface PipelineOptions<T extends PipelineOptions<T>> {}
public interface OptionsA<T extends OptionsA<T>> extends PipelineOptions<T> {
@swegner
swegner / 2016 Top Repositories by Pull Requests Opened.sql
Last active November 11, 2016 21:51
2016 Top Repositories by Pull Requests Opened
WITH pull_requests AS (
SELECT
e.repo.name AS repo,
COUNT(*) AS pr_count
FROM `githubarchive.day.2016*` AS e
WHERE e.type = 'PullRequestEvent' AND STARTS_WITH(e.payload, '{"action":"opened"')
GROUP BY e.repo.name
)
SELECT
pr.repo,
from __future__ import absolute_import
import logging
import apache_beam as beam
from apache_beam.utils.options import PipelineOptions
from apache_beam.utils.options import SetupOptions
from apache_beam.utils.options import StandardOptions
@Test
public void testPrefix() throws IOException {
ClassPath cp = ClassPath.from(ClassLoader.getSystemClassLoader());
Set<ClassPath.ClassInfo> classes = cp.getAllClasses();
int prefixed = 0;
int unPrefixed = 0;
for (ClassPath.ClassInfo classInfo : classes) {
Class<?> clazz;
[TestMethod]
public void FlightsIsolatedOnMultipleFeatureAreas()
{
var abFlight = new Flight(new[] { "A", "B" }, trafficPercent: 100);
var bcFlight = new Flight(new[] { "B", "C" }, trafficPercent: 100);
var cFlight = new Flight(new[] { "C" }, trafficPercent: 100);
_assignmentService.Add(abFlight);
_assignmentService.Add(bcFlight);
_assignmentService.Add(cFlight);