Skip to content

Instantly share code, notes, and snippets.

View hackeris's full-sized avatar

不是油条 hackeris

View GitHub Profile
@hackeris
hackeris / memorize.cpp
Last active December 25, 2021 13:49
C++ memorize function
#include <map>
#include <functional>
#include <iostream>
template<typename R, typename... Args>
auto memorize(std::function<R(Args...)> &&f) {
using Func = std::function<R(Args...)>;
struct memory {
package rainm.play
import scala.language.implicitConversions
object StrongQueryPlay {
trait Table {
def name: String
}
@hackeris
hackeris / !bubble_sort
Last active August 13, 2021 11:37
bubble sort in asm
bubble sort in asm
// from http://codeproject.com/Articles/1209347/Designing-A-Generic-and-Modular-Cplusplus-Memoizer
#include <iostream>
#include <string>
#include <sstream>
#include <tuple>
#include <map>
#include <mutex>
#include <unordered_map>
@hackeris
hackeris / max_sum_of_sub_sequence.py
Created August 28, 2017 10:12
Find max sum of sub sequence
def find_max_sum_of_sub_sequence(seq, start, end):
if end - start == 0:
return seq[start], start, end
else:
mid = (start + end) / 2
left_max, left_start, left_end = find_max_sum_of_sub_sequence(seq, start, mid)
right_max, right_start, right_end = find_max_sum_of_sub_sequence(seq, mid + 1, end)
i = mid
mark_i = i
@hackeris
hackeris / any.h
Created August 9, 2017 11:45 — forked from DieHertz/any.h
#ifndef any_h
#define any_h
namespace utility {
class any {
struct impl_base {
virtual impl_base* clone() const = 0;
virtual ~impl_base() = default;
};
@hackeris
hackeris / webs01.py
Last active March 14, 2023 13:09
SQL Injection and XSS demo on flask(Python).
# -*- coding: utf-8 -*-
import os
import sqlite3
from flask import Flask
from flask import redirect
from flask import request
from flask import session
from jinja2 import Template
import com.google.gson.Gson;
import java.lang.reflect.Proxy;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Created by hackeris on 16/9/16.
*/