Skip to content

Instantly share code, notes, and snippets.

View nskeip's full-sized avatar
🕶️

Nikita Hismatov nskeip

🕶️
View GitHub Profile
@nskeip
nskeip / dh_and_h_normality.g
Last active November 11, 2020 07:29
Верно ли что если Н' нормальна в G, то H нормальна в G?
# Верно ли что если Н' нормальна в G, то H нормальна в G?
# Нет. Приведем пример, когда H' нормальна в G, но H не нормальна в G
# полезное: IsNormal, DerivedSubgroup
# https://alex-konovalov.github.io/ukrgap/gapbook/chapC.html#X87D263A4841FD6A1
for n in [3..10] do
G := SymmetricGroup(n);
Print("Checking ", n, "\n");
for ccs in ConjugacyClassesSubgroups(G) do
H := Representative(ccs);
def proper_plural_form(r, nom_singular, gen, nom_plural):
"""
Если число оканчивается на 1, но не оканчивается на 11, то вариант 1 (Именительный падеж)
Если число оканчивается на 2, 3, 4, и не оканчивается на 12, 13, 14, то вариант 2 (Родительный падеж)
Всё остальное — вариант 3 (Множественный родительный падеж)
"""
if r % 10 == 1 and r % 100 != 11:
return nom_singular
elif r % 10 in (2, 3, 4) and r % 100 not in (12, 13, 14):
return gen
@nskeip
nskeip / check_smtp.py
Last active July 3, 2020 10:19
Django command to test sending a simple email
from django.core.mail import send_mail
from django.core.management.base import BaseCommand
class Command(BaseCommand):
help = 'Tests sending a simple email.'
def add_arguments(self, parser):
parser.add_argument('subject')
parser.add_argument('message')
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@nskeip
nskeip / colorfulAsserts.hs
Created April 21, 2018 05:10
Green OKs and red FAILs test helper :)
{-# LANGUAGE OverloadedStrings #-}
module Main where
import Lib
import GHC.List (take)
import Data.Text as T
import System.Console.ANSI
import System.Exit (exitFailure)
import re
import sys
import sqlite3
import sqlparse
from PyQt5.QtWidgets import *
from PyQt5.QtCore import QAbstractTableModel, Qt
class SQLite3TableModel(QAbstractTableModel):
def __init__(self, db, queriesText, *argv, **kwargs):
@nskeip
nskeip / ParseForm.hs
Last active July 9, 2017 08:30
Parsing forms suggestion for Dashdo project
{-# LANGUAGE OverloadedStrings, ExistentialQuantification, ExtendedDefaultRules, FlexibleContexts, Rank2Types, TemplateHaskell #-}
module Demo where
import Data.Monoid ((<>))
import Lens.Micro.Platform
data ExampleParams = ExampleParams
{ _foo :: Int
, _bar :: [Int]
} deriving (Show)
@nskeip
nskeip / Moving.hs
Last active June 21, 2017 19:50
Moving.hs
{-# LANGUAGE MultiParamTypeClasses, FunctionalDependencies, FlexibleInstances, FlexibleContexts #-}
import Geom2D
left :: (Num a) => Point a -> a -> Point a
left (Point x y) n = Point (x - n) y
right :: (Num a) => Point a -> a -> Point a
right (Point x y) n = Point (x + n) y
up :: (Num a) => Point a -> a -> Point a
fibonacci :: Integer -> Integer
fibonacci 0 = 0
fibonacci 1 = 1
fibonacci n = fibohelper n 1 0
fibohelper 1 acc1 acc2 = acc1
fibohelper c acc1 acc2 = fibohelper (c - 1) (acc1 + acc2) acc1
@nskeip
nskeip / multiple_csv.R
Created June 12, 2014 12:18
Read multiple CSV files into a single dataframe
create_big_data_from_csv_dir <- function(directory, ids) {
# locate the files
files <- list.files(directory, full.names=T)[ids]
# read the files into a list of data.frames
data.list <- lapply(files, read.csv)
# concatenate into one big data.frame
data.cat <- do.call(rbind, data.list)