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> | |
template<int N> | |
struct stupid { | |
static void out(std::ostream& os) { | |
stupid<N-1>::out(os); | |
os << N << std::endl; | |
} | |
}; |
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
$stopwatch = [Diagnostics.Stopwatch]::StartNew() | |
if (-not (Test-Path "json.txt")) { | |
Write-Host "[-] To update owned cards, supply the response to api.php?message=init in json.txt" | |
exit 1 | |
} | |
$account_details = Get-Content "json.txt" | ConvertFrom-JSON -AsHashtable | |
if (-not (Test-Path "cards_section*.xml")) { | |
Write-Host "[-] Run this script inside the optimiser's /data/ directory" |
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
/** | |
* Solver for the Countdown numbers game. Branch-and-bound search. | |
* Compile with: | |
* clang++ -std=c++17 -O3 -o countdown countdown.cpp | |
* | |
* Should find answers in much less than a second. | |
*/ | |
#include <limits> | |
#include <vector> | |
#include <string> |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>Label</key> | |
<string>com.local.jekyll.server.agent</string> | |
<key>ProgramArguments</key> | |
<array> | |
<string>PATH_TO_YOUR_BUNDLE_BINARY_OR_WRAPPER</string> |
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 <algorithm> | |
#include <numeric> | |
#include <iostream> | |
#include <vector> | |
/* | |
* Assuming an input of a string of digits, perform the Luhn test on the indicated sequence. | |
* Returns true if the given string passes the test, false otherwise. | |
*/ | |
bool luhn(const std::string& seq) { |
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
# Recover the key used by the Petya ransomware to encrypt the MFT (master file table) | |
import z3 | |
import sys, struct | |
# XOR key for salsa10-src.bin : | |
KEY_SECTOR = 0x37 | |
# Counter position, as two words | |
CNTLO = 0 | |
CNTHI = 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 <unistd.h> | |
#include <stdbool.h> | |
#include <pthread.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#define NUM_THREADS 10 | |
pthread_mutex_t cv_mutex; | |
pthread_cond_t notification_cv; |
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
import sys | |
def main(): | |
N = raw_input() | |
elements = [int(element) for element in sys.stdin.read().split(' ')] | |
L, R = 0, len(elements) | |
# We got ourselves a maximum subarray problem, with inverted semantics. | |
# The subarray we want to find is the one to flip all the bits in. |
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 nuke noscript | |
// @namespace https://gist.github.com/mfukar/d1dd369deaa7c3941fde | |
// @version 0.2 | |
// @description Remove all <noscript> tags in every document | |
// @author mfukar | |
// @grant none | |
// ==/UserScript== | |
/* jshint -W097 */ | |
'use strict'; |
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
import struct | |
class bitbuffer: | |
# TODO: need reader? | |
def __init__(self): | |
self.buffer = b'' | |
self.byte = 0 | |
self.bit_pos = 7 | |
def append(self, value, nbits): |
NewerOlder