Skip to content

Instantly share code, notes, and snippets.

View aesophor's full-sized avatar

ᴀᴇꜱᴏᴘʜᴏʀ aesophor

View GitHub Profile
cat /flag-415cd468353da8d26974ae6f8a7d9b30a830b8b4
@aesophor
aesophor / tuple_hash.hpp
Created May 31, 2023 14:31
C++17 Tuple Hash
template <typename T, typename... Ts>
constexpr void hash_combine(size_t &seed, const T &t, const Ts &...ts) {
seed ^= std::hash<T>{}(t) + 0x9e3779b97f4a7c15 + (seed << 6) + (seed >> 2);
if constexpr (sizeof...(ts) > 0) {
hash_combine(seed, ts...);
}
}
template <typename T>
@aesophor
aesophor / gomock.md
Created November 3, 2022 02:09 — forked from thiagozs/gomock.md
Tutorial gomock

08/16/17 by  Sergey Grebenshchikov

No Comments

This is a quick tutorial on how to test code using the GoMock mocking library and the standard library testing package testing.

GoMock is a mock framework for Go. It enjoys a somewhat official status as part of the github.com/golang organization, integrates well with the built-in testing package, and provides a flexible expectation API.

@aesophor
aesophor / gen.sh
Created July 19, 2022 02:35
Generate n dummy files in testdir.
#!/usr/bin/env bash
if [ $# -lt 1 ]; then
echo "usage: $0 <nr_test_files>"
exit 0
fi
rm -rf testdir
mkdir -p testdir
#!/usr/bin/env python3
# -*- encoding: utf-8 -*-
def get_total(x, y, z):
return 25 * x + 30 * y + 20 * z
def get_leftover(money, x, y, z):
return money - get_total(x, y, z)
def maybe_show(money, x, y, z):
@aesophor
aesophor / game.py
Last active April 21, 2021 02:43
五子棋 OAO
#!/usr/bin/env python3
# --*-- encoding: utf-8 --*--
import sys
import random
# 常數
empty = 0
player = 1
computer = 2
@aesophor
aesophor / opcodes.sh
Created December 18, 2020 05:03 — forked from mirchr/opcodes.sh
bash one-liner for converting binary object file to shellcode ( i didn't write this)
for i in $(objdump -d shell.o -M intel |grep "^ " |cut -f2); do echo -n '\x'$i; done;echo
@aesophor
aesophor / remove-firefox-sound-tab.scss
Last active December 3, 2020 15:49 — forked from superbiche/remove-firefox-sound-tab.scss
Disable sound indicator icons in Firefox pinned tabs
Paste this fucking shit into userChrome.css
```
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
.tabbrowser-tab[pinned] :-moz-any(.tab-icon-overlay[soundplaying]) {
display: none !important;
}
```
@aesophor
aesophor / three_pipes.cpp
Created October 20, 2020 14:12
three pipes
extern "C" {
#include <sys/wait.h>
#include <unistd.h>
}
#include <iostream>
#include <string>
#include <vector>
int main() {
int pipes[2][2];
@aesophor
aesophor / palenight.js
Last active August 31, 2021 13:32 — forked from ggamel/palenight.js
Material Palenight Color Scheme for Blink Shell
// Material Palenight Color Scheme for Blink Shell
// by Greg Gamel (https://github.com/ggamel) (https://greg.is)
black = '#292d3e';
red = '#f07178'; // red
green = '#c3e88d'; // green
yellow = '#ffcb6b'; // yellow
blue = '#82aaff'; // blue
magenta = '#c792ea'; // pink
cyan = '#89ddff'; // cyan