Skip to content

Instantly share code, notes, and snippets.

Alexander Gazarov DrMetallius

Block or report user

Report or block DrMetallius

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@DrMetallius
DrMetallius / Main.kt
Created Aug 31, 2019
Element ordering in Rx operators
View Main.kt
import io.reactivex.Observable
import io.reactivex.schedulers.Schedulers
import java.util.concurrent.TimeUnit
import kotlin.random.Random
fun main() {
/*
* Output:
*
* 0
@DrMetallius
DrMetallius / ColorPickerActivity.kt
Created Aug 31, 2019
LivingCells color picker activity
View ColorPickerActivity.kt
package com.malcolmsoft.livingcells
import android.app.Activity
import android.content.Intent
import android.content.res.Configuration
import android.graphics.Color
import android.graphics.SweepGradient
import android.graphics.drawable.ColorDrawable
import android.graphics.drawable.Drawable
import android.graphics.drawable.GradientDrawable
@DrMetallius
DrMetallius / listsort.cpp
Created Aug 31, 2019
Linked list sorting
View listsort.cpp
#include <iostream>
struct Entry {
char name[20];
unsigned int price;
Entry *nextEntry;
};
Entry *readAlphabeticList();
Entry *sortByPrice(Entry *list);
View snippet.rs
use winapi::shared::ntdef::LPCWSTR;
use winapi::um::winuser::{BS_DEFPUSHBUTTON, SW_SHOW, WS_CHILD, WS_VISIBLE, WS_TABSTOP, WS_OVERLAPPEDWINDOW, WNDCLASSW};
use winapi::shared::minwindef::{HINSTANCE, UINT, WPARAM, LPARAM, LPVOID, DWORD};
use winapi::shared::windef::{POINT, HBRUSH, HMENU, HWND};
use winapi::um::winuser;
use winapi::um::winuser::{BS_TEXT, GetWindowLongW};
use winapi::um::libloaderapi::GetModuleHandleW;
use winapi::shared::minwindef::LRESULT;
use winapi::shared::wtypesbase::CLSCTX_INPROC_SERVER;
use std::ffi::{OsStr, OsString};
@DrMetallius
DrMetallius / api_model.go
Created Aug 31, 2019
Backup Authentication
View api_model.go
package main
type IdentityProviderLocation struct {
ServerUrl string `json:"server_url"`
Id int `json:"id"`
Login string `json:"login"`
}
type OpenIdentityProviderSessionResponse struct {
AccessToken string `json:"access_token"`
@DrMetallius
DrMetallius / main.rs
Created Aug 31, 2019
S-expression parser
View main.rs
use std::io;
use std::io::{Bytes, Read, Error, ErrorKind};
use std::str;
use std::fmt;
use std::fmt::{Display, Write};
use std::str::FromStr;
fn main() {
let result = ExpressionReader::read(io::stdin()).unwrap();
println!("Result: {:?}", result);
@DrMetallius
DrMetallius / main.rs
Created Aug 31, 2019
Rock Paper Scissors
View main.rs
extern crate rand;
use std::io;
use rand::os::OsRng;
use rand::Rng;
fn main() {
let mut choice_maker = ChoiceMaker::new();
let stdin = io::stdin();
View main.rs
extern crate ftp;
use ftp::FtpStream;
use std::fs::File;
use std::error::Error;
use std::io;
fn main() {
let result = download("example.com:21", "anonymous", "anonymous", ".", "Test.txt");
match result {
View IpifyApiHelper.java
package com.acronis.ipifydemo;
import android.util.Log;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.nio.charset.Charset;
You can’t perform that action at this time.