This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Darwin Nuke PoC | |
* (C) 2015 Hugh Wang | |
* Licence: MIT | |
* | |
* Original research: https://sourceware.org/ml/ecos-discuss/2009-04/msg00031.html | |
* With the help from Kaspersky: https://securelist.com/blog/69462/darwin-nuke/ | |
* | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <sstream> | |
#include <vector> | |
#include <algorithm> | |
using namespace std; | |
using Num = long long; | |
using Array = vector<Num>; | |
Num math_combination(Num total, Num select) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/env python3 | |
g_dbg = False | |
g_rule = {} | |
def print_state(state, text): | |
print('\t[', end='') | |
for i in state['pre']: | |
print('{} -> '.format(i), end='') | |
print('{}] '.format(state['tag']), end='') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
using uint = unsigned int; | |
constexpr uint kLength = 6; | |
constexpr uint kHighBit = 1 << (kLength - 1); | |
constexpr uint kTrim = ((1 << (kLength)) - 1); | |
inline void print_binary(uint v) { | |
for (uint i = 1 << (kLength - 1); i != 0; i >>= 1) { | |
cout << ((v & i) ? 1 : 0); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <algorithm> | |
#include <string> | |
#include <stack> | |
using namespace std; | |
// coroutine start | |
#define _cr_cntr_start constexpr int _counter_start_val = __COUNTER__ | |
#define _cr_cntr_next (__COUNTER__ - _counter_start_val) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
map a :pocket<CR> | |
js <<EOF | |
group.commands.add(["pocket"], | |
"Add to Pocket", | |
function(args) { | |
let url = args.length === 0 ? buffer.uri.spec : args[0]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name No Wiki Wandering | |
// @name:zh-CN 阻止维基漫游 | |
// @namespace hghwng | |
// @version 1 | |
// @grant none | |
// @include *.wikipedia.org/wiki/* | |
// @description Prevent Wikipedia wandering. Show a dialog when you try to visit a new page, and the action is prevented. No wandering, more productivity! | |
// @description:zh-CN 防止维基百科漫游。在尝试访问新页面时弹框报警,并阻止加载。离开漫游,拥抱效率! | |
// ==/UserScript== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
from sys import argv | |
""" | |
Reconstruct GIF header from mobile QQ's stickers. | |
Get the stickers in /sdcard/Tencent/QQ*/.emotionsm/ | |
""" | |
def convert_bytes(data): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import bs4 | |
def convert_element(lines, level=1): | |
result = '' | |
for line in lines: | |
if not isinstance(line, bs4.element.Tag) or \ | |
line.name != 'outline': | |
continue |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(with-eval-after-load 'org | |
(setq start-week 37) | |
(advice-add 'org-read-date-analyze :around | |
(lambda (original-fun ans org-def org-defdecode) | |
(funcall original-fun | |
(if (string-match "^s\\([0-9]+\\)\\(.*\\)" ans) | |
(concat "w" | |
(number-to-string (+ start-week | |
(string-to-number (match-string 1 ans)))) | |
(match-string 2 ans)) |
OlderNewer