Skip to content

Instantly share code, notes, and snippets.

Alexander Slesarev nuald

View GitHub Profile
nuald / int2str.cpp
Created Jul 18, 2017
Sample code to generate binary string from the integer
View int2str.cpp
// Sample code to generate binary string from the integer
// To compile, please use:
// $ clang++ int2str.cpp --std=c++11 -Weverything -Wno-c++98-compat
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
nuald / build.gradle
Last active May 12, 2017
Waiting for the named USB device in macos.
View build.gradle
def APPLICATION_GROUP = 'Application'
ext {
device = 'Cruzer'
program = 'wait'
task compile(type: Exec) {
description 'Compiles the native program.'
nuald / build.gradle
Created Jan 4, 2017
Gradle task for the verification that any Android device is connected and launching a simulator if not.
View build.gradle
apply plugin: ''
task connect(type: ConnectDevicesTask) {
description 'Verifies that any Android device is connected and runs a simulator if not.'
import org.gradle.tooling.BuildException
nuald /
Last active Dec 8, 2016 — forked from franmontiel/
A persistent CookieStore implementation for use in Android with HTTPUrlConnection or OkHttp 2. -- For a OkHttp 3 persistent CookieJar implementation you can use this library:
* Copyright (c) 2015 Fran Montiel
* Copyright (c) 2016 Alexander Slesarev
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
nuald / buildCopy.js
Created Sep 28, 2016
Cordova gulp build hook
View buildCopy.js
module.exports = (ctx) => {
var Q = ctx.requireCordovaModule('q'),
shell = ctx.requireCordovaModule('shelljs');
var gulpDeferral = new Q.defer(),
exitDeferral = new Q.defer();
console.log("Building Web Project.");'../web/');
nuald / gen.R
Created Aug 2, 2016
Generate series for a breach detection sample
View gen.R
#!/usr/bin/env Rscript
parser <- ArgumentParser(
description="Generate series for a breach detection sample"
parser$add_argument("-N", "--checks", type="integer", default=5,
help="Number of checks [default %(default)s]",
parser$add_argument("-M", "--attempts", type="integer", default=6,
nuald / serve.scala
Last active Jan 26, 2018
Simple HTTP Server on Scala/Akka (directory listing)
View serve.scala
#!/usr/bin/env scalas
scalaVersion := "2.12.4"
libraryDependencies += "com.typesafe.akka" %% "akka-http" % "10.0.11"
libraryDependencies += "com.github.scopt" %% "scopt" % "3.7.0"
import akka.event.Logging
nuald / listmacaddrs.c
Last active Nov 9, 2017
Getting MAC addresses
View listmacaddrs.c
#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <ifaddrs.h>
#ifdef AF_LINK
# include <net/if_dl.h>
unsigned char *get_ptr(struct ifaddrs *ifaptr) {
if (((ifaptr)->ifa_addr)->sa_family == AF_LINK) {
return (unsigned char *)LLADDR((struct sockaddr_dl *)(ifaptr)->ifa_addr);
nuald /
Last active Jul 2, 2016
Multicasting chat sample
#!/usr/bin/env python3
""" Multicasting chat application """
import socket
import struct
import sys
from threading import Thread
MADDX = ''
PORT = 6543
nuald /
Created Jul 2, 2016
Simple password generator
#!/usr/bin/env python3
""" Simple password generator """
import random
import argparse
def main():
""" Main entry """
parser = argparse.ArgumentParser()
You can’t perform that action at this time.