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 <string.h> | |
#include <assert.h> | |
#include "subsample.h" | |
/* helper func: GCD(m,n) */ | |
static int helper_gcd(int m, int n) | |
{ | |
return (n == 0) ? m : helper_gcd(n, m % n); | |
} |
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 <cstdio> | |
#include <string> | |
int main() { | |
using namespace std::literals::string_view_literals; | |
for (char c: "Hello"sv) { | |
std::printf("(%d)", c); | |
} | |
} |
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 <cstdio> | |
#include <string> | |
int main() { | |
using namespace std::literals::string_literals; | |
for (char c: "Hello"s) { | |
std::printf("(%d)", c); | |
} | |
} |
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 <stdio.h> | |
size_t f(size_t, char [][*]); | |
size_t f(size_t n, char r[][2 < n ? f(n-2, 0) + f(n-1, 0) : 1]) | |
{ | |
return sizeof(*r); | |
} | |
int main() |
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 USE_GCC_ABI_DEMANGLE 1 | |
#include <iostream> | |
#include <typeinfo> | |
#if USE_GCC_ABI_DEMANGLE | |
#include <cxxabi.h> | |
#endif | |
template <typename T, typename R, typename... Args> | |
void dump(R (T::*pmf)(Args...)) |

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 <cassert> | |
#include <cstdlib> | |
#include <condition_variable> | |
#include <mutex> | |
#include <system_error> | |
#include <thread> | |
#define CHECKED_MUTEX_ISSUE_ABORT 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
#!/usr/bin/env python3 | |
from http import server | |
server_address = ('localhost', 8080) | |
class Handler(server.SimpleHTTPRequestHandler): | |
def do_GET(self): | |
print('-' * 79) | |
super(Handler, self).do_GET() | |
print(self.headers) |
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 | |
LIBJPEG=/usr/local/opt/jpeg/bin/cjpeg | |
MOZJPEG=/usr/local/opt/mozjpeg/bin/cjpeg | |
LIBJEPG_OPTS="" | |
MOZJPEG_OPTS="" | |
QRANGE=`seq 80 100` | |
# ImageMagick | |
IDENTIFY=/usr/local/opt/imagemagick/bin/identify |
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
const char *n2b(unsigned n, int l) { | |
static char buf[32+1]; | |
for (int i = 0; i < l; i++) { | |
buf[l - i - 1] = (n & 1) ? '1': '0'; | |
n >>= 1; | |
} | |
buf[l] = '\0'; | |
return buf; | |
} |