Skip to content

Instantly share code, notes, and snippets.

@mvasilkov
mvasilkov / rts
Last active December 27, 2015 04:09
RTS: remove trailing spaces
#!/bin/bash
find . -not \( -name CVS -prune -or -name .git -prune \) -type f -print0 \
|xargs -0 sed -Ei '' 's/[[:space:]]{1,}$//'
@mvasilkov
mvasilkov / require.py
Last active December 19, 2015 06:48
Helper tool for Box2D-HTML5 conversion. Fucking kill Google, one Closure Library at a time.
import re
import sys
def wrap(filename):
print(filename)
with open(filename) as f:
text = f.read()
ms = re.findall(r"goog\.require\('(.+?)'\)", text)
if not ms:
ms = ['box2d']
{
"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"
#!/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> |
# | |
# +----------------------------------------------------------------------+
@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
import re
import random
CURLY_RE = re.compile( "\{(.*?)\}" )
def spam( filename, n=1 ):
file = open(filename, "r")
{
{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.|
@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.
"""
@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.");
{
"jam": {
"packageDir": "media/lib",
"baseUrl": "media",
"dependencies": {
"jquery": null,
"raphael": null
}
}
}