Skip to content

Instantly share code, notes, and snippets.

PRAGMA foreign_keys=OFF;
BEGIN TRANSACTION;
CREATE TABLE chat(
msgid integer primary key,
time datetime,
userid integer,
username text,
avatar_url text,
@Zirak
Zirak / shell.js
Last active August 29, 2015 14:16
var readline = require('readline'),
fs = require('fs'),
tty = require('tty');
var device = fs.openSync('/dev/ttyO4', 'r+');
var rstream = new tty.ReadStream(device),
wstream = new tty.WriteStream(device);
rstream.on('data', function (chunk) {
@Zirak
Zirak / linux.md
Last active September 10, 2016 10:06
Packages/installations

In order (maybe). Some stuff are Arch specific.

Base system stuff

  • grub
  • os-prober

A decent shell and a way to talk to the world

  • zsh
  • grml-zsh-config
  • fish
@Zirak
Zirak / mirror.el
Last active March 10, 2018 19:23
Mirror Elpa (or Melpa or whatever)
;;;;;;;;;;
;; https://github.com/Zirak/mirror-elpa
;;;;;;;;;;
;; mirrors melpa into a ~packages~ subdirectory
;; you can run a web-server in said subdirectory and use it as a package archive
(defun read-archive (url)
(with-temp-file (expand-file-name "archive-contents" "packages")
(url-insert-file-contents (concat url "archive-contents"))
@Zirak
Zirak / index.js
Created December 13, 2014 01:55
requirebin sketch
var Promise = require('bluebird');
new Promise(function (resolve, reject) {
reject(new Error('I am grumpy'));
}).catch(function (err) {
console.warn('grumpyness averted!', err);
}).then(function () {
throw new Error('muahahaha');
});
// hi, this explains the current bot architecture. comment pl0x.
// this is the object which the bot sees (and all listeners/commands receive)
var message = {
text : 'message text sans any invocation stuff',
user : {
name : '',
id : '',
reputation : '',
isOwner : function () { /*...*/ }
@Zirak
Zirak / meh.js
Last active September 16, 2015 03:51
/*global Promise, Rx*/
/*global DOMParser, WebSocket, URL, fetch*/
/*global fkey*/
function fetchJson (url, options) {
// fetch closed up sending an object as a form. fak.
if (options.body === Object(options.body)) {
options.body = URL.stringify(options.body);
options.headers = options.headers || {};
NumericLiteral ::
DecimalLiteral
HexIntegerLiteral
OctalIntegerLiteral
DecimalLiteral ::
DecimalIntegerLiteral . DecimalDigits(opt) ExponentPart(opt)
...
DecimalIntegerLiteral ::
Changes from HEAD to working tree
6 files changed, 195 insertions(+), 132 deletions(-)
source/bot.js | 65 +------------------------
source/memory.js | 103 ++++++++++++++++++++++++++++++++++++++++
source/plugins/export.js | 32 -------------
source/plugins/import-export.js | 82 ++++++++++++++++++++++++++++++++
source/plugins/import.js | 35 --------------
source/util.js | 10 +++-
Modified source/bot.js
@Zirak
Zirak / gist:2effbe232f3c7d961eca
Created September 12, 2014 17:14
scrollIntoViewIfNeeded
// centering doesn't work I don't care fuck you sideways
Element.prototype.scrollIntoViewIfNeeded = function (centerIfNeeded) {
var box = this.getBoundingClientRect(),
parentNode = this.parentNode,
parent = parentNode.getBoundingClientRect();
var above = box.top < parent.top,
below = box.bottom > parent.bottom,
toRight = box.right > parent.right,
toLeft = box.left < parent.left;