Skip to content

Instantly share code, notes, and snippets.

View jnovikov's full-sized avatar

Ivan Novikov jnovikov

  • Dublin, Ireland
  • 05:18 (UTC)
View GitHub Profile

Keybase proof

I hereby claim:

  • I am johnnovikov on github.
  • I am johnnovikov (https://keybase.io/johnnovikov) on keybase.
  • I have a public key whose fingerprint is B68C CAAB 6B43 F385 920E F119 B32B 9552 297F 3C62

To claim this, I am signing this object:

from PIL import Image, ImageDraw # Подключим необходимые библиотеки.
def add_zeroes(num):
n = bin(num)[2:]
c = 8 - len(n)
return c * '0' + n
def create_encrypted(num, bit):
@jnovikov
jnovikov / db.py
Created June 23, 2017 12:58
DB for MSHP LETO CTF READY
import sqlite3
conn = sqlite3.connect('example.db')
db = conn.cursor()
# query = "CREATE TABLE IF NOT EXISTS users (id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, login TEXT,password TEXT)"
# db.execute(query)
@jnovikov
jnovikov / req.py
Created July 6, 2017 13:51
Python requests example
# coding=utf-8
import requests
url = 'http://web7.shadowservants.ru'
r = requests.get(url)
# Получить список кукизов
print(r.cookies.items())
print(r.text)
# Отправка своих кукизов
own_cookies = {'is_admin':'1'}
@jnovikov
jnovikov / main.cpp
Last active December 16, 2017 09:51
Strtok example with split
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstring>
#include <cstdlib>
using namespace std;
const int MAX_LEN = 101;
int split_words(char *text,char *div,char out[][MAX_LEN]) {
int counter = 0;
@jnovikov
jnovikov / main.cpp
Last active February 16, 2018 14:54
Struct example
#include <iostream>
#include <fstream>
using namespace std;
struct Student {
char name[100];
double mark_mem;
double mark_cat;
};
@jnovikov
jnovikov / main.cpp
Created February 16, 2018 21:13
kek
#include <iostream>
#include <ctime>
#include <iomanip>
#include <cstring>
using namespace std;
class Student {
@jnovikov
jnovikov / main.cpp
Created February 17, 2018 09:41
Constructor and destructor example
#include <iostream>
#include <iomanip>
using namespace std;
class Student {
private:
char name[51];
char surname[51];
@jnovikov
jnovikov / state.py
Created February 17, 2018 11:46
State pattern
class AbstractState(object):
def set_machine(self, machine):
raise NotImplementedError
def get_coffee(self):
raise NotImplementedError
class CappuccinoState(AbstractState):
def set_machine(self, machine):
class BaseLogStrategy(object):
def log(self, message):
raise NotImplementedError()
class StdoutStrategy(BaseLogStrategy):
def log(self, message):
print(message)