Skip to content

Instantly share code, notes, and snippets.

Adrian Wielgosik adrian17

  • Polska
Block or report user

Report or block adrian17

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
@adrian17
adrian17 / kakuro.py
Created Feb 23, 2015
Kakuro solver in Python
View kakuro.py
import itertools
from copy import deepcopy
def possible_combinations(values, n, total):
# generate all combinations of given values with given sum
return [combination for combination in itertools.combinations(values, n) if sum(combination) == total]
def make_aval(board, clues):
"""
Generates a set of all digits you can use in each cell, just like you do in sudoku board
@adrian17
adrian17 / kanji_easy.json
Last active Sep 23, 2018
kanji data for NHK News Web Easy
View kanji_easy.json
{
"desc": "kanji frequency for NHK News Web Easy, 1855 articles from 2014-12-02 to 2016-07-15",
"source": "https://gist.github.com/adrian17/836b97ee5740b20e63edbe35251d6bc1",
"label": "easy news",
"total": 158118,
"list": [
[
"人",
5093
],
@adrian17
adrian17 / patcher.py
Created Jul 22, 2014
TH autobomb patcher
View patcher.py
import shutil
import os
games = [
{"name": "th10", "offset": 0x25013, "data": [0xf6, 0x05, 0x5c, 0x4e, 0x47, 0x00, 0x02, 0x0f, 0x84, 0x52, 0x01, 0x00, 0x00]},
{"name": "th11", "offset": 0x30679, "data": [0xf6, 0x05, 0xc0, 0x93, 0x4c, 0x00, 0x02, 0x0f, 0x84, 0xd5, 0x02, 0x00, 0x00]},
{"name": "th12", "offset": 0x3619b, "data": [0xf6, 0x05, 0xd0, 0x49, 0x4d, 0x00, 0x02, 0x0f, 0x84, 0xe8, 0x01, 0x00, 0x00]},
{"name": "th125", "offset": 0x3ace8, "data": [0xf6, 0x05, 0x10, 0xb2, 0x4d, 0x00, 0x02, 0x0f, 0x84, 0xf9, 0x00, 0x00, 0x00]},
{"name": "th13", "offset": 0x42925, "data": [0xf6, 0x05, 0x14, 0x4c, 0x4e, 0x00, 0x02, 0x0f, 0x84, 0x2c, 0x01, 0x00, 0x00]},
{"name": "th14", "offset": 0x4d2c4, "data": [0xf6, 0x05, 0x9c, 0x8a, 0x4d, 0x00, 0x02, 0x0f, 0x84, 0x00, 0x01, 0x00, 0x00]}
View gist:445f1b8ebbe0020256cbbc355a17bd9d
printf 'à____]\0k“ôç¹ñ6$s8,gã®]•TÍNäsÐÐs«Ò܍@:ñ=/¸Â-¶ ‡ß9¿Í~ë¬PJdÆv³—Q›¹­E¶çøäkƒ5bÉoŠ€ÁÚN®È@ëPuÞ¨Ä3׶*<§†N]¥:µV»jUÑÁYÑ.qGÄ
uá–vPå.úU!Ð\äŒÞ, ìÓè¬_'|xz -dqqFraw
View gist:d457c1110dadad58b9b2f084d8e58799
#include <iostream>
#include <string>
#include <regex>
int main() {
std::regex pattern(R"((\d+) #(.+)# (\d+) ([\d.]+))");
std::string line = "83 #Electric Sander# 7 57.00";
// imagine that's inside the while() loop
View gist:2e4df101b03175fa9c36d25cbef7e9dd
#include <string>
#include <iostream>
#include <vector>
#include <utility>
#include <chrono>
#include <unordered_set>
using namespace std::chrono;
View ub14.txt
import timeit
import time
import subprocess
lines = [
"a = ''",
"a = ' '",
"a = ' '",
"a = 'a'",
"a = 'a b a b '*100",
@adrian17
adrian17 / main.py
Created Aug 24, 2016
Python implementation of anagram solver
View main.py
from collections import defaultdict
import string
words = open("enable1.txt").read().splitlines()
print(max(len(x) for x in words))
def add(a, b):
return tuple(x+y for x, y in zip(a, b))
def over(a, b):
@adrian17
adrian17 / main.cpp
Last active Aug 24, 2016
slightly simpler and slower anagram generator implementation
View main.cpp
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <array>
#include <fstream>
#include <xmmintrin.h>
#include <experimental/string_view>
using namespace std;
using namespace std::experimental;
@adrian17
adrian17 / main.cpp
Created Jul 25, 2016
concepts diagn
View main.cpp
template<typename T> using id=T;
template<typename T>
concept bool A = requires(T a) { a==a; };
template<typename T, typename U>
concept bool B =
A<T> && // (1) basic usage
A<T> && // (2) duplicate concept check
A<U> && // (3) different concept check that happens to work on the same type here
You can’t perform that action at this time.