Skip to content

Instantly share code, notes, and snippets.

View JIghtuse's full-sized avatar

Boris Egorov JIghtuse

View GitHub Profile
@JIghtuse
JIghtuse / main.dart
Created March 14, 2023 09:39
Dart void?
void main() {
int? x = 42;
print(x);
void? v; // compile error
}
@JIghtuse
JIghtuse / log_parser.cpp
Created July 13, 2017 06:12
HTTP log parser
#include <cctype>
#include <cstdlib>
#include <fstream>
#include <iostream>
#include <string>
#include <unordered_map>
#include <queue>
const int kDefaultNumberOfResults = 100;
@JIghtuse
JIghtuse / variadic_template_issue.cpp
Created April 24, 2017 14:20
Cppcheck variadic template issue
template <typename> struct a;
template <typename> struct b;
template <typename... c> struct d : a<b<c...>> {};
int main() {}
/* Output:
Checking prep.cpp ...
@JIghtuse
JIghtuse / hana_crash.cpp
Created April 24, 2017 13:41
cppcheck crash
#include <boost/hana.hpp>
namespace hana = boost::hana;
template <typename a, std::enable_if_t<hana::Constant<a>::b>> a sqrt() {
hana::integral_c<sqrt(a::b)>;
}
int main() {}
@JIghtuse
JIghtuse / spellcheck.py
Created November 24, 2016 16:43
Spellchecker using enchant
#!/usr/bin/env python3
"""Spellchecks src/*.md files with enchant"""
import glob
import sys
import enchant
from enchant.tokenize import get_tokenizer, EmailFilter, URLFilter
DICT_TAG = "en_US"
@JIghtuse
JIghtuse / insertion_sort.h
Last active April 4, 2022 09:14
Some sort algorithms in modern C++
#pragma once
#include <algorithm>
#include <functional>
template<typename ForwardIt, typename Compare = std::less<>>
void insertion_sort(ForwardIt begin, ForwardIt end, Compare comp = Compare{})
{
if (std::distance(begin, end) < 2) {
return;
}
@JIghtuse
JIghtuse / dictionary.txt
Created October 9, 2016 15:33
Spellchecking rust book
personal_ws-1.1 en 0 utf-8
abcabcabc
Addr
alignof
api
APIs
aren
ay
b'A
backtrace
@JIghtuse
JIghtuse / stepic-mail-system-main.java
Created October 6, 2016 17:36
Mail System main method
package com.company;
import java.util.logging.*;
public class Main {
public static void main(String[] args) {
Logger logger = Logger.getLogger("main");
@JIghtuse
JIghtuse / gen_dict.sh
Last active September 30, 2016 09:56
Spellchecking markdown files
#!/bin/sh
# Generates list of spellings in *.md files
SPELLINGS_FILE=spellings.txt
cat ./*.md | aspell list | sort -u > "$SPELLINGS_FILE"
#cat spellings.txt >> ~/.aspell.en.pws
@JIghtuse
JIghtuse / simple-scheme-crash.scm
Created September 28, 2016 06:28
big-bang Simple scheme program
(define scn (empty-scene))
(define width (image-width scn))
(define height (image-height scn))
(define (render-circle r)
(place-image
(circle r "solid" "red")
(/ width 2)
(/ height 2)