Skip to content

Instantly share code, notes, and snippets.

View omalley's full-sized avatar

Owen O'Malley omalley

View GitHub Profile
# Get the initial install time
FLASH_TIME=$(opkg info busybox | grep '^Installed-Time: '| cut -d' ' -f2)
# For each installed package
# if it was installed by the user
# and it was installed after the flash_time
# and it isn't a dependency, print it out
opkg list-installed | cut -d' ' -f1 | xargs -n 1 opkg info | \
awk -F: '/Package:/ {pkg = $2; gsub(" ","", pkg)} /Depends:/ {split($2,parts,", "); for (i in parts) {split(parts[i], words, " "); dep[words[1]] = 1}} /Status:/ {status = $2} /Installed-Time:/ {if ($2 > '"$FLASH_TIME"' && status == " install user installed") {pkglist[pkgcnt++] = pkg}} END {for (i in pkglist) {pkg = pkglist[i]; if (!(pkg in dep)) {print pkglist[i]}}}' | \
sort
#!/usr/bin/python3
#
import os
import subprocess
import sys
cherry_pick_file = ".git/CHERRY_PICK_HEAD"
if os.path.exists(cherry_pick_file):
commit_msg_file = sys.argv[1]
enum LogLevel {
TRACE, DEBUG, INFO, WARN, ERROR, FATAL
}
record LogLocation {
union{null, string} className;
union{null, string} fileName;
union{null, long} lineNumber;
union{null, string} methodName;
}
>>> def fib(n):
... last = 0
... current = 1
... for i in range(n):
... (last, current) = (current, last + current)
... return current
...
>>> fib(3)
3
>>> fib(100)
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
package org.apache.orc.examples;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.hive.ql.exec.vector.BytesColumnVector;
import org.apache.hadoop.hive.ql.exec.vector.LongColumnVector;
import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch;
import org.apache.orc.OrcFile;
import org.apache.orc.TypeDescription;
import org.apache.orc.Writer;
@omalley
omalley / OrcWriter2.java
Created November 24, 2015 19:30
An example ORC writer using a dynamic schema in Hive 2.0
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.hive.ql.exec.vector.BytesColumnVector;
import org.apache.hadoop.hive.ql.exec.vector.LongColumnVector;
import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch;
import org.apache.orc.CompressionKind;
import org.apache.orc.TypeDescription;
import org.apache.orc.OrcFile;
import org.apache.orc.Writer;
@omalley
omalley / OrcWriter.java
Created November 24, 2015 19:00
A sample ORC writer using a dynamic schema
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.Text;
Verifying that +omalley is my blockchain ID. https://onename.com/omalley
@omalley
omalley / mac2038.c
Created April 7, 2015 19:11
The following program demonstrates a 2038 bug in Mac OS 10.10.2.
#include <stdio.h>
#include <time.h>
/*
Demonstrates the Mac OS bug for 2038. The output on Mac OS/X 10.10.2 in PDT:
In 2036 2093587200 - 2093562000 = 25200
In 2037 2125126800 - 2125101600 = 25200
In 2038 2156666400 - 2156637600 = 28800
In 2039 2188202400 - 2188173600 = 28800