Skip to content

Instantly share code, notes, and snippets.

var obj = function() {}
obj.prototype.f = function(name) { if (this[name] === void 0) this[name] = new obj; return this[name] }
obj.prototype.get = function(name) { return this[name] }
obj.prototype.set = function(name, value) { this[name] = value }
// Usage:
var x = new obj
x.f("file").f("document").f("properties").set("т прнс?", true)
@mvasilkov
mvasilkov / baka.conf
Created February 7, 2013 19:38
./comment.sh baka.conf sendsms-user
group = core
admin-port =
admin-password =
log-file = "/var/log/kannel/bearerbox.log"
log-level = 3
status-password =
access-log = "/var/log/kannel/access_kannel.log"
store-location = "/var/log/kannel/store_sms"
smsbox-port =
# dlr-storage = mysql
{
"jam": {
"packageDir": "media/lib",
"baseUrl": "media",
"dependencies": {
"jquery": null,
"raphael": null
}
}
}
@mvasilkov
mvasilkov / array2d.c
Last active December 14, 2015 08:39
This is a demo of 2D arrays in C written for my (imaginary) friend.
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char const *argv[])
{
int **array2d, n, i, j;
puts("Enter a number:");
scanf("%d", &n);
puts("Thank you, kind sir.");
@mvasilkov
mvasilkov / image.py
Created March 24, 2013 11:34 — forked from homm/image.py
# -*- coding: utf-8 -*-
from PIL import Image, ImageMath
def paste_composite(original, paste):
"""
Вставляет в первое изображение второе, с учетом альфаканала обоих.
Оба изображения должны быть в формате RGBA.
"""
{
{I have|I've} been {surfing|browsing} online more than {three|3|2|4} hours today, yet I never found any interesting article like yours. {It's|It
is} pretty worth enough for me. {In my opinion|Personally|In my view}, if all {webmasters|site owners|website owners|web owners} and bloggers made good content as
you did, the {internet|net|web} will be {much more|a lot more}
useful than ever before.|
I {couldn't|could not} {resist|refrain from} commenting. {Very well|Perfectly|Well|Exceptionally well} written!|
{I will|I'll} {right away|immediately} {take hold of|grab|clutch|grasp|seize|snatch}
your {rss|rss feed} as I {can not|can't} {in finding|find|to find} your {email|e-mail} subscription {link|hyperlink} or {newsletter|e-newsletter} service. Do {you have|you've} any?
{Please|Kindly} {allow|permit|let} me {realize|recognize|understand|recognise|know} {so that|in order that} I {may just|may|could} subscribe.
Thanks.|
import re
import random
CURLY_RE = re.compile( "\{(.*?)\}" )
def spam( filename, n=1 ):
file = open(filename, "r")
@mvasilkov
mvasilkov / lib.js
Created June 17, 2013 19:03
Sample code for Kiril Vatev
var lib = function() {
/* lib() is the same as lib.a() */
return lib.a.apply(lib, arguments)
}
lib.a = function() {
/* do somethig, e.g. */
console.log('lib.a() called with', arguments)
/* allow chaining */
return lib
#!/bin/bash
# +----------------------------------------------------------------------+
# | |
# | Mount the root file system / with the option noatime |
# | |
# | By Philipp Klaus <http://blog.philippklaus.de> |
# | Tip found on <http://blogs.nullvision.com/?p=275> |
# | |
# +----------------------------------------------------------------------+
{
"apache": {
"process": "/usr/sbin/httpd",
"start": "sudo apachectl start",
"stop": "sudo apachectl stop"
},
"mysql": {
"process": "/usr/local/Cellar/mysql/5.6.12/bin/mysqld",
"start": "mysql.server start > /dev/null",
"stop": "mysql.server stop > /dev/null"