Skip to content

Instantly share code, notes, and snippets.

View corpix's full-sized avatar
👹
Fighting demons

corpix corpix

👹
Fighting demons
View GitHub Profile
@corpix
corpix / convert.coffee
Created June 7, 2012 15:49
Конвертирование видео по расширению параллельно
#!/bin/env coffee
require 'colors'
childProcess = require 'child_process'
spawn = childProcess.spawn
program = require 'commander'
os = require 'os'
fs = require 'fs'
async = require 'async'
# Cached variables
@corpix
corpix / fedora.pxe.sh
Created June 17, 2012 21:02
PXE netinstall
#!/bin/bash
ARCH=i386
RELEASE=17
TFTP=/var/lib/tftpboot
A_TARGET=$TFTP/fedora/$RELEASE/$ARCH
TARGET=fedora/$RELEASE/$ARCH
MIRROR=http://mirror.yandex.ru/fedora/linux/releases/$RELEASE/Fedora/$ARCH/os
@corpix
corpix / backup.sh
Created July 12, 2012 12:50
Incremental rsync backups
#!/bin/bash
trap "echo Exited!; exit;" SIGINT SIGTERM
SOURCE="/home/" # Path to data needs backup
YESTERDAY=`date -I -d "1 day ago"`
TODAY=`date -I`
SERVER="user@server"
STORAGE="/storage/backup"
@corpix
corpix / start.sh
Created July 14, 2012 09:32
Forever start
#!/bin/bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
###
# index.js >>
# process.setuid('nobody')
# process.setgid('nobody')
###
USER=nobody
@corpix
corpix / xstream-staxdriver.java
Created August 16, 2012 19:58
XStream StaxDriver Omit/Disable XMLS declaration
private XStream xstream = new XStream(new StaxDriver(){
public StaxWriter createStaxWriter(XMLStreamWriter out) throws XMLStreamException {
return createStaxWriter(out, false);
}
});
@corpix
corpix / java-launcher.nsi
Created August 16, 2012 20:24
NSIS Java app launcher
; Java Launcher
;--------------
Name "Batch playlist"
Caption "Batch playlist"
Icon "playlist-icon.ico"
OutFile "BatchPlaylist.exe"
SilentInstall silent
AutoCloseWindow true
@corpix
corpix / events.js
Created September 2, 2012 08:12
Events
context.on('click', function(){
// Какой-то код
});
setTimeout(function() {
context.trigger('click'); // "Бросаем" событие `click`
}, 5 * 1000); // Событие будет вызвано через 5 секунд
@corpix
corpix / protos.js
Created October 22, 2012 17:55
наследование
var Me = function(){
this.name = 'Dmitriy';
}
Me.prototype.printName = function(){
console.log(this.name);
}
var You = function(){
this.name = 'Username';
@corpix
corpix / buffer.concat_vs_buf.toString.js
Created October 23, 2012 11:36
Buffer.concat(list) vs str += buf.toString()
var chunks = 10000;
var buf;
buf = new Buffer(4069);
buf.fill('a', 0, 4069);
(function(){
var arr = [],
concated,
j = 0;
@corpix
corpix / strings.test.js
Created November 4, 2012 19:06
str[i] vs str.charAt(i)
var str = '',
max = 5000000,
tmp,
i = 0;
for( ; i < max; i++){
str += 'a';
}