Skip to content

Instantly share code, notes, and snippets.

SELECT
# Find the average temperature
ROUND(AVG(temp),2) AS temp_avg_f,
stn AS noaa_station_number FROM
(
SELECT * FROM `bigquery-public-data.noaa_gsod.gsod2015` UNION ALL SELECT * FROM `bigquery-public-data.noaa_gsod.gsod2016` UNION ALL SELECT * FROM `bigquery-public-data.noaa_gsod.gsod2017`
)
GROUP BY 2 ORDER BY 1 DESC LIMIT 5;
FROM java:8-jre
ENV CATALINA_HOME /usr/local/tomcat
ENV PATH $CATALINA_HOME/bin:$PATH
RUN mkdir -p "$CATALINA_HOME"
WORKDIR $CATALINA_HOME
# see https://www.apache.org/dist/tomcat/tomcat-8/KEYS
RUN gpg --keyserver pool.sks-keyservers.net --recv-keys \
05AB33110949707C93A279E3D3EFE6B686867BA6 \
public class TCB {
private Thread thread = null;
private int tid = 0;
private int pid = 0;
private boolean terminate = false;
// User file descriptor table:
// each entry pointing to a file (structure) table entry
public FileTableEntry[] ftEnt = null;
public class FileTable {
private Vector table; // the actual entity of this file table
private Directory dir; // the root directory
public FileTable( Directory directory ) { // constructor
table = new Vector( ); // instantiate a file (structure) table
dir = directory; // receive a reference to the Director
} // from the file system
public class FileTableEntry { // Each table entry should have
public int seekPtr; // a file seek pointer
public final Inode inode; // a reference to its inode
public final short iNumber; // this inode number
public int count; // # threads sharing this entry
public final String mode; // "r", "w", "w+", or "a"
public FileTableEntry ( Inode i, short inumber, String m ) {
seekPtr = 0; // the seek pointer is set to the file top
inode = i;
iNumber = inumber;
public class Directory {
private static int maxChars = 30; // max characters of each file name
// Directory entries
private int fsize[]; // each element stores a different file size.
private char fnames[][]; // each element stores a different file name.
public Directory( int maxInumber ) { // directory constructor
fsizes = new int[maxInumber]; // maxInumber = max files
for ( int i = 0; i < maxInumber; i++ )
class Superblock {
public int totalBlocks; // the number of disk blocks
public int totalInodes; // the number of inodes
public int freeList; // the block number of the free list's head
public SuperBlock( int diskSize ) {
...
}
...
}
@aerodame
aerodame / Inode.java
Created May 27, 2015 03:56
Inode.java
public class Inode {
private final static int iNodeSize = 32; // fix to 32 bytes
private final static int directSize = 11; // # direct pointers
public int length; // file size in bytes
public short count; // # file-table entries pointing to this
public short flag; // 0 = unused, 1 = used, ...
public short direct[] = new short[directSize]; // direct pointers
public short indirect; // a indirect pointer
public class Kernel
{
private static SyncQueue ioQueue;
...
public static int interrupt( int irq, int cmd, int param, Object args ) {
TCB myTcb;
switch( irq ) {
case INTERRUPT_SOFTWARE: // System calls
switch( cmd ) {
@aerodame
aerodame / SyncQueue-Wail.java
Created April 29, 2015 05:41
SyncQueue WaitQueue
public class Kernel
{
private static SyncQueue waitQueue;
...
public static int interrupt( int irq, int cmd, int param, Object args ) {
TCB myTcb;
switch( irq ) {
case INTERRUPT_SOFTWARE: // System calls
switch( cmd ) {