Skip to content

Instantly share code, notes, and snippets.

View SkymanOne's full-sized avatar
🎯
Focusing

Gherman SkymanOne

🎯
Focusing
View GitHub Profile
# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to log to the console when each text editor is saved.
#
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->
@SkymanOne
SkymanOne / main.py
Created March 20, 2018 15:27
Base telegram bot heroku application
import telebot
import os
from telebot import types
from flask import Flask, request
# если в окуржении есть переменная HEROKU, значит получаем токен из переменной окружения
if 'HEROKU' in list(os.environ.keys()):
TOKEN = str(os.environ.get('TOKEN'))
# иначе импортируем его из скрытого в файлы в папке проекта
else:
using System;
namespace codewars10._06
{
class Program
{
static void Main(string[] args)
{
//set up the field as an array from the example test case
int[,] field = new int[10, 10]
func tableView(_ tableView: UITableView, trailingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? {
let task: Task = tasks[indexPath.row]
let action: UIContextualAction = UIContextualAction(style: .destructive, title: "Finish", handler: {
(action, view, completionHandler) in
self.tasks.remove(at: indexPath.row)
tableView.deleteRows(at: [indexPath], with: .fade)
completionHandler(true)
})
@SkymanOne
SkymanOne / Launch Xamarin.iOS app
Last active September 18, 2020 22:04
VS Code Task config to launch iOS app in Xamarin.Forms project
{
//just copy paste in .vscode/tasks.json
//run by pressing cmd+shift+p
"version": "2.0.0",
"tasks": [
{
"label": "build",
"group": "build",
"command": "msbuild",
"type": "process",
@SkymanOne
SkymanOne / MultithreadExample.cs
Created August 26, 2021 21:12
Mini multithread application example
using System;
using System.Threading;
namespace threadTest
{
class Program
{
static void Main(string[] args)
{
//Let's create a dedicated thread to demmonstarte that the whole process can be done inside another thread

Keybase proof

I hereby claim:

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

To claim this, I am signing this object:

@SkymanOne
SkymanOne / b_tree.rs
Last active February 20, 2022 16:17
Basic binary tree in rust
//alias a complex type for cleaner code
pub type Link = Option<Box<Node>>;
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct Node {
value: i8,
left_node: Link,
right_node: Link,
}
impl Node {
@SkymanOne
SkymanOne / aes-modes.rs
Last active July 17, 2022 16:48
Solution to Polkadot Academy extra challenge on Sunday
//! In Module 1, we discussed Block ciphers like AES. Block ciphers have a fixed length input.
//! Real wold data that we wish to encrypt _may_ be exactly the right length, but is probably not.
//! When your data is too short, you can simply pad it up to the correct length.
//! When your data is too long, you have some options.
//!
//! In this exercise, we will explore a few of the common ways that large pieces of data can be broken
//! up and combined in order to encrypt it with a fixed-length block cipher.
//!
//! WARNING: ECB MODE IS NOT SECURE.
//! Seriously, ECB is NOT secure. Don't use it irl. We are implementing it here to understand _why_ it
use parity_scale_codec::{ Encode, Decode};
use sp_core::{H256, H512, Pair};
type Salt = u8;
const SALT: Salt = 5u8;
#[derive(Encode, Decode, Debug, PartialEq, Eq, Clone)]
pub struct BasicExtrinsic {
operation: Operation,