Skip to content

Instantly share code, notes, and snippets.

Avatar

Serge Shirokov kurokikaze

View GitHub Profile
@kurokikaze
kurokikaze / gist:350fe1713591641b3b42
Created Oct 3, 2014
install chrome from powershell
View gist:350fe1713591641b3b42
(new-object System.Net.WebClient).DownloadFile('http://dl.google.com/chrome/install/375.126/chrome_installer.exe', 'c:/temp/chrome.exe');. c:/temp/chrome.exe /silent /install;rm c:/temp -rec
View test.js
/**
* Auto-generated code below aims at helping you parse
* the standard input according to the problem statement.
**/
const S = readline();
// Write an answer using console.log()
// To debug: console.error('Debug messages...');
console.error(S)
@kurokikaze
kurokikaze / removecomment.go
Created Sep 30, 2011
Remove comments from Go/C program (simple way)
View removecomment.go
package main
import bufio "bufio"
import fmt "fmt"
import os "os"
func main() {
var state = "0"
var cache = " "
@kurokikaze
kurokikaze / server.js
Created May 5, 2010
Simple work queue implementation for node.js
View server.js
var net = require('net'),
sys = require('sys');
var messages = [];
var work_in_progress = [];
var host = '192.168.175.128';
var port = 8999;
var server = net.createServer(function(client_stream) {
@kurokikaze
kurokikaze / getCPS.js
Last active Dec 22, 2015
Получает текущий CPS по номеру варианта (0 - курсор, 1 - бабушка и т.д.) и цену следующего айтема по номеру.
View getCPS.js
var getCPS = function(num) {
var text = document.getElementById('rowInfoContent' + num.toString()).innerText.split('\n');
var count = parseInt(text[0].replace(/,/g, '').match(/\s(\d+)\s/)[1]);
var production = parseFloat(text[1].replace(/,/g, '').match(/\s([\d,.]+)\s/)[1]);
return production/count;
}
var getPrice = function(num) {
return parseInt(document.getElementById('product' + num.toString()).children[1].children[1].innerText.replace(/,/g,''))
}
@kurokikaze
kurokikaze / theseus.js
Created Dec 2, 2011
Алгоритм Тезея для черепашки: http://www.kurilo.su/programmers/
View theseus.js
var dirs = {'north':0,'east':1,'south':2,'west':3};
var names = ['north','east','south','west'];
var obs = {'north':north,'south':south,'west':west,'east':east};
result='east';
if (!direction) direction = 'east';
var left = function() {
return names[(dirs[direction] + 3) % 4];
};
@kurokikaze
kurokikaze / gist:1316636
Created Oct 26, 2011
Calculate dividends per share price and dividends per portfolio value on EmpireAvenue
View gist:1316636
$('div.item').find('li').each(function(i, el) {
var price = parseFloat($(el).find('span.float-right.large').eq(0).text().split(' ')[0]);
var dividend = $(el).find('span.portfolio-meta').eq(0).text();
var pattern = /Last Dividend: ([\d\.]+)/
var pattern_pval = /Portfolio Value:\s([\d\.,]+)e/
var nums = dividend.match(pattern);
if (nums) {
var divperprice = parseFloat(nums[1]) / price;
console.log('Dividend per price for ' + $(el).find('div.influencer-portrait').find('a').eq(0).attr('href') + ': ' + divperprice);
}
View server.js
var oc = function(a) {
var o = {};
for(var i=0;i<a.length;i++) {
o[a[i]]='';
}
return o;
}
var http = require('http'),
url = require('url'),
@kurokikaze
kurokikaze / test.js
Created Jan 26, 2011
Websocket 76 opening handshake demo for Node.js
View test.js
var crypto = require('crypto');
var key1 = 155712099;
//var key1 = 829309203;
var key2 = 173347027;
// var key2 = 259970620;
//var sign = '^n:ds[4U';
var sign = 'Tm[K T2u';
function intToBigEndian(intstr){
var st = new Buffer(4);
@kurokikaze
kurokikaze / nodejs.ru.xsl
Created Jan 19, 2011
Система верстки на XML+XSLT
View nodejs.ru.xsl
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:exslt="http://exslt.org/common"
xmlns:math="http://exslt.org/math"
xmlns:date="http://exslt.org/dates-and-times"
xmlns:func="http://exslt.org/functions"
xmlns:set="http://exslt.org/sets"
xmlns:str="http://exslt.org/strings"
xmlns:dyn="http://exslt.org/dynamic"
xmlns:saxon="http://icl.com/saxon"
You can’t perform that action at this time.