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
#Ubuntu 16.04LTS does not apply network settings after boot. | |
#See https://bugs.launchpad.net/ubuntu/+source/procps/+bug/50093 | |
#Work around this issue with a cron job to disable SACK | |
@reboot /bin/sleep 5 && /sbin/sysctl -w net.ipv4.tcp_sack=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
import org.jetbrains.annotations.NotNull; | |
import javax.swing.ListModel; | |
import java.util.AbstractList; | |
public enum ListModels | |
{ | |
; | |
public static @NotNull <E> Iterable<E> asIterable(final @NotNull ListModel<E> model) |
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
find . -type f -iname "*.*" -print | rev | cut -d . -f 1 | rev | sort | uniq -c | sort -nr | less |
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
integer go to, do 100 if, return | |
character*12 read | |
logical go to if | |
real logical(30) | |
data read / 12h(1x,i5,f8.1) / | |
data go to, do 100 if, if 100 do / 2, 1, 30 / | |
assign 100 to if go to | |
do 100 if = do 100 if,if 100 do | |
return = if | |
logical(if) = return |
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
// ctime is an obsolete time function that is present in many older Unix programs. | |
// It's common for programs to call it and then modify the output. | |
// Here's a strftime format string that should produce the same output. | |
// dest_len should be >= 26 | |
static void get_time_str(time_t val, char *dest, size_t dest_len) | |
{ | |
struct tm result; | |
localtime_r(&val, &result); | |
// e.g. Wed Oct 27 18:28:32 2021\n | |
strftime(dest, dest_len, "%a %b %e %H:%M:%S %Y\n", &result); |
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
#ifndef NULLABILITY_TYPEDEFS_H | |
#define NULLABILITY_TYPEDEFS_H | |
#define MAKE_NULLABILITY_TYPEDEFS(type, name) \ | |
typedef const type *const _Nonnull name##_pure_ptr; \ | |
typedef const type *_Nonnull name##_const_ptr; \ | |
typedef type *_Nonnull name##_ptr; \ | |
typedef type *_Nullable name##_null_ptr; \ | |
typedef const type *const _Nullable name##_pure_null_ptr; \ | |
typedef type *_Nonnull *_Nonnull name##_ptr_ptr; \ |
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
/// Cast a nullable pointer to a non-null pointer | |
/// This is unsafe and should be justified with a comment | |
/// containing the keyword WHY | |
/// For example, "WHY - checked" | |
template <typename T> | |
[[nodiscard]] constexpr static inline auto | |
as_live(T *_Nullable value) -> T *_Nonnull | |
{ | |
return static_cast<T *_Nonnull>(value); | |
} |
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
#ifndef CHAR_PREDICATES_HPP | |
#define CHAR_PREDICATES_HPP | |
[[nodiscard]] static inline bool | |
is_digit(int ch) | |
{ | |
return ((ch >= '0') && (ch <= '9')); | |
} | |
[[nodiscard]] static inline bool |
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
#pragma once | |
#include <ostream> | |
/// RAII guard class for saving and restoring ostream state | |
class ostream_guard final | |
{ | |
std::ostream *os_; | |
std::streamsize width_; | |
std::streamsize precision_; |
OlderNewer