Skip to content

Instantly share code, notes, and snippets.

View maks's full-sized avatar

Maksim Lin maks

View GitHub Profile
// JsChat client code using Rhino
// rlwrap java -jar js.jar
// load('jschat-client-rhino.js');
var JsChat = {};
JsChat.Connection = function(server_address, port) {
importPackage(java.io);
importPackage(java.net);
@kig
kig / gzip.js
Last active August 1, 2019 08:59
TarGZ = function(){};
// Load and parse archive, calls onload after loading all files.
TarGZ.load = function(url, onload, onstream, onerror) {
var o = new TarGZ();
o.onload = onload;
o.onerror = onerror;
o.onstream = onstream;
o.load(url);
return o;

###Object.preventExtensions

  • Make object non-extensible (can't add properties)

###Object.seal

  • Make object non-extensible (can't add properties)
  • Make object's own properties non-configurable (can't remove them, or change their nature and/or attributes)

###Object.freeze

  • Make object non-extensible (can't add properties)
  • Make object's own properties non-configurable (can't remove them, or change their nature and/or attributes)
var http = require('http');
var Buffer = require('buffer').Buffer;
http.createServer(function (req, res) {
var n = 1024, b;
for (var i = 1; i <= 30; i++)
b = new Buffer(n);
res.writeHead(200, {"Content-Type": "text/plain"});
res.end(b);
}).listen(8000);
@hns
hns / ringoproxy.js
Created October 28, 2010 00:39
A minimal RingoJS HTTP proxy
var httpclient = require("ringo/httpclient");
var {Headers} = require("ringo/webapp/util");
var {startsWith} = require("ringo/utils/strings");
var base = "http://localhost:8080";
var sites = {
"frau.helma.at": "/frauhelma",
"pool.helma.at": "/pool",
"henso.com": "/henso",
@michiel
michiel / cors-nginx.conf
Created July 5, 2011 10:41
Wide-open CORS config for nginx
#
# Wide-open CORS config for nginx
#
location / {
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*';
#
@paulirish
paulirish / data-markdown.user.js
Last active February 6, 2024 10:41
*[data-markdown] - use markdown, sometimes, in your HTML
// ==UserScript==
// @name Use Markdown, sometimes, in your HTML.
// @author Paul Irish <http://paulirish.com/>
// @link http://git.io/data-markdown
// @match *
// ==/UserScript==
// If you're not using this as a userscript just delete from this line up. It's cool, homey.
@rafalrusin
rafalrusin / fbtest.c
Created December 15, 2011 20:22
Linux Frame Buffer Test
#include <linux/fb.h>
#include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
#include <string.h>
#include <sys/mman.h>
@jhorstmann
jhorstmann / gist:1579903
Created January 8, 2012 22:15
How to modify android-x86 asus_laptop image to add rtl8192se wireless lan driver

The "intellibook" netbook contains a rtl8192se pci network chip that is not currently included in the android-x86 builds. I could not get a complete self-build image to work so I decided to add the neccessary drivers to the existing release from 20120101. This has the added benefit that the installation contains the google apps, which are not included in the source download. The image can be downloaded from http://www.android-x86.org/releases/build-20120101 (android-x86-4.0-asus_laptop-20120101.iso).

Extract the iso image and the contained squashfs image and mount the contained filesystem image as a loopback device.

$ bsdtar -C android-image -xf android-x86-4.0-asus_laptop-20120101.iso
$ cd android-image
$ unsquashfs system.sfs
$ sudo mkdir /mnt/iso
$ sudo mount ./squashfs-root/system.img /mnt/iso  -o loop
@vadmium
vadmium / sbs.diff
Created January 13, 2012 13:34
SBS for Python-Iview
SBS for Python-Iview
* Overrides all the ABC Iview function, you only get SBS instead
* I hacked the internal interface for the list items in order to get the
front end to display multiple tree branches for the one SBS XML file, but
it should be done in a nicer way.
* Only works with the GTK version; probably breaks the CLI version
* I don’t think I ever finished the “Copy URL” button idea. But it would be
nice to be able to quickly pipe a URL into a video player and stream it
without worrying about downloading it.