Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 PuTao without 4K | |
// @version 1.0.1 | |
// @namespace https://abcdabcd987.com | |
// @homepageURL https://gist.github.com/abcdabcd987/9839987cf0b7cc13e2d9e4b030a188b5 | |
// @author Lequn Chen | |
// @description Remove links to 4K videos in the torrent list. | |
// @run-at document-idle | |
// @match *://pt.sjtu.edu.cn/torrents.php* | |
// ==/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
diff -ruN orig/kernel/src/allocator/bin.rs new/kernel/src/allocator/bin.rs | |
--- orig/kernel/src/allocator/bin.rs 2018-08-02 19:23:14.000000000 +0800 | |
+++ new/kernel/src/allocator/bin.rs 2018-08-04 11:18:29.000000000 +0800 | |
@@ -1,5 +1,6 @@ | |
use std::fmt; | |
-use alloc::heap::{AllocErr, Layout}; | |
+use core::alloc::{AllocErr, Layout}; | |
+use core::ptr::NonNull; | |
use allocator::util::*; |
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
diff -ruN orig/bootloader/Xargo.toml new/bootloader/Xargo.toml | |
--- orig/bootloader/Xargo.toml 2018-07-18 23:59:41.000000000 +0800 | |
+++ new/bootloader/Xargo.toml 2018-07-19 22:31:03.000000000 +0800 | |
@@ -2,10 +2,6 @@ | |
core = {} | |
std_unicode = {} | |
-[dependencies.compiler_builtins] | |
-features = ["mem"] | |
-stage = 1 |
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
// g++ cache-prefetching.cc -Wall -std=c++11 -g -pthread -O2 | |
#include <string> | |
#include <vector> | |
#include <mutex> | |
#include <random> | |
#include <chrono> | |
#include <thread> | |
#include <iomanip> | |
#include <iostream> |
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/bash | |
# thanks to http://stackoverflow.com/a/20743090 | |
# thanks to https://github.com/diogovk/c2nasm | |
# install objconv: https://github.com/vertis/objconv | |
# | |
# $1: source code | |
set -e | |
C_FILE="$1" | |
BASE_NAME="${C_FILE%.*}" |
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 <vector> | |
/** | |
Given an non-decreasing ordered array `arr`, search the biggest `i` that makes `arr[i] == value`. | |
If `i` doesn't exist, return -1 | |
*/ | |
int search_last_match(const std::vector<int>& arr, const int value) | |
{ | |
int lef = 0, rig = static_cast<int>(arr.size()); | |
while (rig-lef > 1) |
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 <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
/* ****************************************************************** | |
ALTERNATING BIT AND GO-BACK-N NETWORK EMULATOR: VERSION 1.1 J.F.Kurose | |
This code should be used for PA2, unidirectional or bidirectional | |
data transfer protocols (from A to B. Bidirectional transfer of data | |
is for extra credit and is not required). Network properties: |
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
#if 0 | |
set -e | |
binname=$(mktemp --suffix -delay-fs.bin) | |
g++ -o "$binname" -Wall -g -O2 "$0" -lfuse3 -lpthread | |
"$binname" $@ | |
rm "$binname" | |
exit | |
#endif | |
// delay-fs: | |
// A filesystem from which reading a file incurs 50ms delay for each byte. |
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
// g++-7 sharding.cc -Wall -std=c++17 -g -pthread -O2 -ltbb | |
#include <cassert> | |
#include <cstdlib> | |
#include <cstring> | |
#include <string> | |
#include <mutex> | |
#include <shared_mutex> | |
#include <optional> | |
#include <random> |