Skip to content

Instantly share code, notes, and snippets.

import re
from io import StringIO
from decimal import Decimal
# TODO:
# - investigate: late column casts better than early? (make temp table all text?)
# - encoder/decoder for all django field types
# - sanitize method interfaces of CopyConverter / more django-like
# - Do we need a temp file shim instead of StringIO for very big data?
# - Better with ByteIO instead of StringIO?
#!/bin/bash
function smiling_smiley() {
echo -ne '\x1bP;2q"1;1;60;60
#6!60~$-
!60~$-
!60~$
!15?#1!4]!22?!4]$-
#6!60~$-
!60~$-
const pty = require('./lib/index');
var ptyProcess = pty.spawn('bash', [], {
name: 'xterm-color',
cols: 80,
rows: 30,
cwd: '/',
env: process.env
});
import { Terminal, ITerminalAddon, IBufferCell } from 'xterm';
export class SerializeAddon implements ITerminalAddon {
private _terminal: Terminal|undefined = undefined;
public dispose(): void {}
public activate(terminal: Terminal): void {
this._terminal = terminal;
}
private _extractAttributes(oldCell: IBufferCell, newCell: IBufferCell): string {
import { Terminal, ITerminalAddon } from 'xterm';
export const enum Attributes {
/**
* bit 1..8 blue in RGB, color in P256 and P16
*/
BLUE_MASK = 0xFF,
BLUE_SHIFT = 0,
PCOLOR_MASK = 0xFF,
PCOLOR_SHIFT = 0,
var Module = require('module');
var originalRequire = Module.prototype.require;
// monkey patch require paths
Module.prototype.require = function() {
const path = arguments[0];
if (path.slice(0, 6) === 'common') {
return require('xterm/out/' + path);
}
if (path.slice(0, 4) === 'core') {
#!/bin/bash
# Tom Hale, 2016. MIT Licence.
# Print out 256 colours, with each number printed in its corresponding colour
# See http://askubuntu.com/questions/821157/print-a-256-color-test-pattern-in-the-terminal/821163#821163
set -eu # Fail on errors or undeclared variables
printable_colours=256
import { perfContext, before, ThroughputRuntimeCase } from '..';
//import * as xterm from 'xterm';
import { Terminal as TerminalType } from 'xterm/src/Terminal';
const Terminal: typeof TerminalType = require('xterm/lib/Terminal').Terminal;
const pty = require('xterm/node_modules/node-pty');
class TestTerminal extends Terminal {
writeSync(data: string) {
this.writeBuffer.push(data);
const Terminal = require('xterm/lib/Terminal').Terminal;
const pty = require('xterm/node_modules/node-pty');
const perfContext = require('../lib/index').perfContext;
const before = require('../lib/index').before;
const RuntimeCase = require('../lib/index').RuntimeCase;
class TestTerminal extends Terminal {
writeSync(data) {
this.writeBuffer.push(data);
this._innerWrite();
const fs = require('fs');
const Terminal = require('./lib/Terminal').Terminal;
class TestTerminal extends Terminal {
writeSync(data) {
this.writeBuffer.push(data);
this._innerWrite();
}
}