Skip to content

Instantly share code, notes, and snippets.

View iluxonchik's full-sized avatar
😉

Illya Gerasymchuk iluxonchik

😉
View GitHub Profile
@iluxonchik
iluxonchik / .tmux.config
Created December 20, 2018 00:10
tmux config
# remap prefix from 'C-b' to 'C-a'
unbind C-b
set-option -g prefix C-a
bind-key C-a send-prefix
# pane resizing with Ctrl+Shift+Arrow
bind-key -n C-S-Up resize-pane -U 15
bind-key -n C-S-Down resize-pane -D 15
bind-key -n C-S-Left resize-pane -L 25
bind-key -n C-S-Right resize-pane -R 25
@iluxonchik
iluxonchik / client.c
Last active May 5, 2022 01:29
Proof Of Concept mbedTLS client and server
#if !defined(MBEDTLS_CONFIG_FILE)
#include "mbedtls/config.h"
#else
#include MBEDTLS_CONFIG_FILE
#endif
#if defined(MBEDTLS_PLATFORM_C)
#include "mbedtls/platform.h"
#else
#include <stdio.h>
@iluxonchik
iluxonchik / jwplayer_downloader.py
Created December 14, 2017 08:38
Download JWPlayer .ts files, merge them into a single file and then convert the file to .mp4
"""
For my Neuroengineering course presentation my group wanted to download some videos,
the problem is that those videos were played by the JWPlayer, so obtaining the video
files was a little tricky. What I noticed from observing the network traffic is that
JWPlayer downloads the video files in chunks (each chunk was 4 seconds long) and
in .ts format. My goal was to combine all of those small video segments into a single
one and then convert the file to .mp4. To combine the multiple video chunks into one
I used the "cat" command and to convert resulting .ts file to .mp4 I used the "ffmpeg"
tool.
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")

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:

@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)
@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 / 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 / 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"]
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;