Skip to content

Instantly share code, notes, and snippets.

View iluxonchik's full-sized avatar
😉

Illya Gerasymchuk iluxonchik

😉
View GitHub Profile
#ifndef __BENEFICIARY_H__
#define __BENEFICIARY_H__
// Abstarct class
class Beneficiary {
public:
Beneficiary() { }
virtual int totalHelpRecieved() = 0;
virtual void addHelpRecieved(int value) = 0;
package poof.core;
import java.util.HashMap;
public class Directory extends FileSystemEntitiy {
/**
*
*/
private static final long serialVersionUID = -1968533951935404039L;
V E V + E Time Space
100 100 200 2 301832
1000 1000 2000 5 346624
10000 15000 25000 22 788248
100000 150000 250000 118 5198408
500000 550000 1050000 1808 24797504
1000000 1100000 2100000 3624 49297504
2000000 2500000 4500000 9438 98298272
3000000 3000000 6000000 10022 147298544
private static void run()
{
ProcessStartInfo pstartInfo = new ProcessStartInfo();
pstartInfo.FileName = @"C:\Program Files (x86)\Livestreamer\livestreamer.exe";
pstartInfo.Arguments = "rtmp://eumedia1.livecoding.tv:1935/livecodingtv/kitty_cent?t=6812FAC8CF464F2D8340D7FCA92AA033 worst --stdout --stream-timeout 120";
pstartInfo.UseShellExecute = false;
pstartInfo.RedirectStandardOutput = true;
Process p = new Process();
p.StartInfo = pstartInfo;
@iluxonchik
iluxonchik / Cargo.toml
Last active November 2, 2015 22:36
Rust Hello World Lib
[package]
name = "helloworldlib"
version = "0.1.0"
authors = ["ILUXONCHIK <iluxon4ik@hotmail.com>"]
[lib]
name = "helloworldlib"
crate-type = ["dylib"]
@iluxonchik
iluxonchik / namescount.py
Last active August 26, 2016 07:06
Alternative implementation of namescount.py using collections.defaultdict from the blog post "Why You Should Learn Python" https://iluxonchik.github.io/why-you-should-learn-python/
#!/usr/bin/env python3
import sys
from collections import defaultdict
def count_names():
names = defaultdict(int)
for name in sys.stdin.readlines():
name = name.strip()
names[name] += 1
@iluxonchik
iluxonchik / IsPrimeRegex.swift
Created September 9, 2016 14:09
Regex that checks if a number is prime in Swift 2. From blog post "Demystifying The Regular Expression That Checks If A Number Is Prime" at https://iluxonchik.github.io/regular-expression-check-if-number-is-prime/ | Submitted by Russel: https://disqus.com/by/disqus_527bF1C8Ck/
/*
Regex that checks if a number is prime in Swift 2.
From blog post "Demystifying The Regular Expression That Checks If A Number Is Prime"
at https://iluxonchik.github.io/regular-expression-check-if-number-is-prime/
Submitted by Russel: https://disqus.com/by/disqus_527bF1C8Ck/
*/
func isPrime(n: Int) -> Bool {
do {
return try NSRegularExpression(
@iluxonchik
iluxonchik / Android Leak Log
Created May 16, 2017 09:13
To reproduce the bug: Login--->Logout
05-16 09:08:31.636 26919-26919/pt.ulisboa.tecnico.cmov.locmess E/ActivityThread: Activity pt.ulisboa.tecnico.cmov.locmess.main.MainMenuActivity has leaked IntentReceiver pt.ulisboa.tecnico.cmov.locmess.WifiDirect.SimWifiP2pBroadcastReceiver@6ee446 that was originally registered here. Are you missing a call to unregisterReceiver()?
android.app.IntentReceiverLeaked: Activity pt.ulisboa.tecnico.cmov.locmess.main.MainMenuActivity has leaked IntentReceiver pt.ulisboa.tecnico.cmov.locmess.WifiDirect.SimWifiP2pBroadcastReceiver@6ee446 that was originally registered here. Are you missing a call to unregisterReceiver()?
at android.app.LoadedApk$ReceiverDispatcher.<init>(LoadedApk.java:1159)
at android.app.LoadedApk.getReceiverDispatcher(LoadedApk.java:946)

Keybase proof

I hereby claim:

  • I am iluxonchik on github.
  • I am iluxonchik (https://keybase.io/iluxonchik) on keybase.
  • I have a public key ASA61SRDsPmx6oIBndQPesiolIoXVyCrLDBGd3SPXlCMZAo

To claim this, I am signing this object:

findWSS <- function(data) {
print(paste("[TRACER] Finding WSS.."))
start <- Sys.time()
wss <- (nrow(data)-1)*sum(apply(data,2,var))
for (i in 2:length(unique(data))) {
wss[i] <- sum(kmeans(data, centers=i)$withinss)
}
plot(1:length(unique(data)), wss, type="b", xlab="Number of Clusters", ylab="Within groups sum of squares")