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
pub trait IteratorExt: std::iter::Iterator { | |
fn group_by<F, K, G>(self, f: F) -> HashMap<K, Vec<G>> | |
where | |
Self: Sized, | |
K: Eq + Hash, | |
F: FnMut(Self::Item) -> (K, G); | |
} | |
impl<T> IteratorExt for T |
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
FROM ghcr.io/graalvm/graalvm-community:21 AS build | |
WORKDIR /app | |
COPY NioPath.java . | |
RUN javac NioPath.java && native-image -Dsun.jnu.encoding=UTF-8 NioPath | |
FROM debian:12-slim AS production | |
COPY --from=build /app/niopath /bin/niopath | |
CMD ["/bin/niopath", "àéïõû.txt"] |
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/sh | |
if test "$1" = "-x"; then | |
shift | |
command=$@ | |
/usr/bin/x-terminal-emulator -e sh -c "$command" | |
else | |
/usr/bin/x-terminal-emulator $@ | |
fi |
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/sh | |
set -x | |
youtube-dl -f140 --add-metadata -i $@ |
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
ctx.upstream().transact { | |
post(..., 10.second) | |
post(...) | |
} |
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
ctx.upstream().with { | |
post(a) | |
post(b) | |
... | |
} |
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
struct thread_params { | |
shared_ptr<Store> store; | |
}; | |
struct thread_params * p = new struct thread_params; | |
p->store = store; | |
CreateThread(&initThread, p) |
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
typedef struct { | |
Element* start; | |
size_t len; | |
size_t cap; | |
} vector; | |
vector* vector_new () { | |
vector* vec = (vector*) malloc(sizeof(vec)); | |
vec->cap = 10; | |
vec->start = (Element*) malloc(sizeof(Element) * vec->cap); |
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
<?php | |
namespace SciMS; | |
use SciMS\Secure; | |
use SciMS\Model\User; | |
use SciMS\Model\ArticleQuery; | |
return [ | |
'/articles' => [ |
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 | |
with open('ch7.bin') as f: | |
data = "".join(f.readlines()) | |
for shift in range(0, 255): | |
sys.stdout.write('%d >>> ' % shift) | |
for i in range(0, len(data)): | |
sys.stdout.write(chr((ord(data[i])+shift) % 255)) | |
sys.stdout.write('\n') |
NewerOlder