This file contains hidden or 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<bits/stdc++> | |
/Meisell-Lehmer | |
const int MAX_N = 5e6 + 2; | |
bool np[MAX_N]; | |
int prime[MAX_N], pi[MAX_N]; | |
int getprime() | |
{ | |
int cnt = 0; | |
np[0] = np[1] = true; | |
pi[0] = pi[1] = 0; |
This file contains hidden or 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 <bits/stdc++.h> | |
#define IOS std::ios::sync_with_stdio(false); std::cin.tie(nullptr); std::cout.tie(nullptr); | |
// #define __DEBUG__ | |
#ifdef __DEBUG__ | |
#define DEBUG(...) printf(__VA_ARGS__) | |
#else | |
#define DEBUG(...) | |
#endif | |
#define filename "" |
This file contains hidden or 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
-- Detect if the Safari window exists | |
tell application "System Events" | |
if not (exists (front window of process "Safari")) then | |
return | |
end if | |
end tell | |
-- Assume the frontmost Finder window (or the Desktop) | |
-- is where we want to store the script. | |
try |
This file contains hidden or 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
// C++ includes used for precompiling -*- C++ -*- | |
// Copyright (C) 2003-2013 Free Software Foundation, Inc. | |
// | |
// This file is part of the GNU ISO C++ Library. This library is free | |
// software; you can redistribute it and/or modify it under the | |
// terms of the GNU General Public License as published by the | |
// Free Software Foundation; either version 3, or (at your option) | |
// any later version. |
This file contains hidden or 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
{ | |
"title": "SpaceFN", | |
"rules": [ | |
{ | |
"description": "SpaceFN: Space enables SpaceFN mode (see: https://geekhack.org/index.php?topic=51069.0 & https://spacelauncherapp.com)", | |
"manipulators": [ | |
{ | |
"type": "basic", | |
"from": { | |
"key_code": "spacebar" |
This file contains hidden or 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 Redirect Huxiu Mobile Link | |
// @namespace https://gist.github.com/TshuW/136f461b93dc258f6322b496fd656717 | |
// @version 0.1 | |
// @description Redirect m.huxiu.com to www.huxiu.com | |
// @author Tshu Wang | |
// @match m.huxiu.com/article/* | |
// @grant none | |
// ==/UserScript== |
This file contains hidden or 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
;;; System interaction function | |
(defun supress-frame-splitting (&rest r) | |
(let ((frame-name (frame-parameter nil 'name))) | |
(when (or (equal "capture" frame-name) | |
(equal "agenda" frame-name)) | |
(delete-other-windows)))) | |
(defun org-capture-finalize@after (&rest r) | |
(when (equal "l" (plist-get org-capture-plist :key)) | |
(run-at-time 0 nil #'osx-switch-back-to-previous-application)) |
This file contains hidden or 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 Arxiv titlatorizer | |
// @namespace Titlatorizer | |
// @version 0.1 | |
// @description Set correct tab <title> on arXiv pages. | |
// @author Tianshu Wang | |
// @match https://arxiv.org/pdf/* | |
// @grant GM_xmlhttpRequest | |
// ==/UserScript== | |
// |
This file contains hidden or 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
settings.scrollStepSize = 100 | |
settings.focusAfterClosed = "last" | |
settings.hintAlign = "left" |
This file contains hidden or 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
on open location address | |
if {address starts with "org-protocol"} then | |
do shell script "zsh -c 'ec \"" & address & "\"'" | |
else | |
do shell script "zsh -c 'ec --eval '\"'\"'(browse-url \"" & address & "\")'\"'\"''" | |
end if | |
end open location | |
on open filenames | |
set args to "" |
OlderNewer