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 <iomanip> | |
#include <iostream> | |
#include <string> | |
using namespace std; | |
inline double ToDouble(const string &sOrg) | |
try { | |
return stod(sOrg); | |
} |
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
#! /bin/bash | |
priv="/etc/pki/private/mok/signing_key.pem" | |
x509="/etc/pki/private/mok/signing_key.x509" | |
akdir="/var/cache/akmods" | |
kver="$(uname -r)" | |
sifi="/usr/src/kernels/${kver}/scripts/sign-file" | |
tmpf="/tmp/modsign_tmp.ko" |
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 <Windows.h> | |
#include <math.h> | |
#include <stdio.h> | |
void ErrorExit(const char *pszWhat) { | |
auto dwError = GetLastError(); | |
char *pBuf; | |
FormatMessageA( | |
FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, | |
nullptr, dwError, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPSTR) &pBuf, 0, nullptr |
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 <algorithm> | |
#include <chrono> | |
#include <cstddef> | |
#include <cstdio> | |
#include <random> | |
#include <string> | |
#include <vector> | |
using namespace std; | |
using namespace chrono; |
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 <cstdint> | |
namespace { | |
using namespace std; | |
template<uint32_t MaxCCol = 9 * 9 * 4, uint32_t MaxCNode = 9 * 9 * 9 * 9, uint32_t MaxCAns = 9 * 9> | |
class DancingLink { | |
private: | |
struct Node { | |
uint32_t U, D, L, R; | |
uint32_t Col, Row; |
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
-- add admin user | |
declare @adminUname varchar(32) = 'admin'; | |
declare @adminPword varchar(32) = 'admin'; | |
declare @adminSalt binary(64) = crypt_gen_random(64); | |
declare @adminStoredPword binary(64) = hashbytes('SHA2_512', convert(binary, @adminPword) + @adminSalt); | |
insert into [dbo].[User]([uname], [storedPword], [salt], [priv]) values | |
(@adminUname, @adminStoredPword, @adminSalt, 0); | |
-- add demo flights | |
declare @Airport table([iata] char(3) primary key); |
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
#define _CRT_SECURE_NO_WARNINGS | |
#define _WIN32_LEAN_AND_MEAN | |
#include <cstdint> | |
#include <memory> | |
#include <string> | |
#include <utility> | |
#include <Windows.h> |
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
#define WIN32_LEAN_AND_MEAN | |
#include <Windows.h> | |
#include <cstdlib> | |
#include <exception> | |
#include <filesystem> | |
#include <fstream> | |
#include <iostream> | |
#include <stdexcept> | |
#include <string> |
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
set nocompatible | |
set encoding=utf-8 | |
set fileencodings=utf-8,gbk,s-jis | |
set expandtab | |
set shiftwidth=4 | |
set softtabstop=4 | |
set tabstop=4 |
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
// PRNG: Middle Square Weyl Sequence | |
// | |
// This is a rewrite of mswsrngv3 from https://mswsrng.wixsite.com/rand in | |
// C++14. This file is licensed under MIT license. | |
// | |
// Use msws::Msws as a UniformRandomBitGenerator and RandomNumberEngine. | |
// #define MSWS_NOIOS to remove formatted I/O support with C++ input/output | |
// streams. | |
// | |
// MIT License |