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
| curl -Ss -u <username> --header "X-GitHub-OTP: <OTP from your SMS or App>" https://api.github.com/orgs/<orgname>/repos | \ | |
| jq -a -r ".[].ssh_url" | \ | |
| xargs -I "{}" git clone "{}"` |
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 rlgl, raylib | |
| proc main = | |
| setConfigFlags(flags(ConfigFlags.WindowResizable)) | |
| initWindow(800, 600, "Triangle") | |
| defer: closeWindow() | |
| let shader = loadShaderCode(""" | |
| #version 330 core | |
| layout (location = 0) in vec3 aPos; | |
| void 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
| CREATE OR REPLACE PROCEDURE migrate(key_input TEXT) LANGUAGE plpgsql AS | |
| $$ | |
| BEGIN | |
| -- create table to persist migration status | |
| CREATE TABLE IF NOT EXISTS migrations ( | |
| "key" TEXT NOT NULL, | |
| created TIMESTAMP NOT NULL DEFAULT NOW() | |
| ); | |
| -- check if already migrated | |
| IF NOT EXISTS (SELECT * FROM migrations WHERE migrations."key" = key_input) THEN |
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
| @echo off | |
| FOR /f "tokens=*" %%i IN ('docker ps -aq') DO docker rm %%i | |
| FOR /f "tokens=*" %%i IN ('docker images --format "{{.ID}}"') DO docker rmi %%i |
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 java.io.PrintWriter; | |
| import java.util.ArrayList; | |
| import java.util.Collections; | |
| import java.util.List; | |
| import java.util.Random; | |
| import java.util.stream.Collectors; | |
| import org.junit.platform.engine.discovery.DiscoverySelectors; | |
| import org.junit.platform.launcher.Launcher; | |
| import org.junit.platform.launcher.core.LauncherDiscoveryRequestBuilder; |
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
| public static class Ref<T> { | |
| public final Supplier<T> get; | |
| public final Consumer<T> set; | |
| public Ref(Supplier<T> get, Consumer<T> set) { | |
| this.get = get; | |
| this.set = set; | |
| } | |
| public T get() { |
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
| package de.hetzge.jdbc | |
| import java.sql.Connection; | |
| import java.sql.ResultSet; | |
| import java.sql.Statement; | |
| /** | |
| * Container for {@link Connection}, {@link Statement} and {@link ResultSet} that can be used to | |
| * close all this resources together. | |
| */ |
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
| Flux<ByteBuf> flux = Flux.generate( | |
| () -> new ChunkedStream(new FileInputStream(new File("c:/temp/data.csv"))), | |
| (state, sink) -> { | |
| try { | |
| ByteBuf buf = state.readChunk(ByteBufAllocator.DEFAULT); | |
| if (buf != null) { | |
| sink.next(buf); | |
| } else { | |
| sink.complete(); | |
| } |
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
| package com.zf.v2x.mapmanager.api.st; | |
| import java.io.FilterInputStream; | |
| import java.io.IOException; | |
| import java.io.InputStream; | |
| import java.util.function.Consumer; | |
| public class ProgressInputStream extends FilterInputStream { | |
| private volatile long totalReadByteCount; | |
| private final Consumer<Long> progressConsumer; |
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
| function readLineByLine(data, callback) { | |
| let dataLength = data.length; | |
| let lineStart = 0; | |
| for (let i = 0; i < dataLength; i++) { | |
| // 10 = \n | |
| // 13 = \r | |
| if (data[i] === 10 || data[i] === 13) { | |
| try { | |
| const line = data.slice(lineStart, i).toString().trim(); | |
| if (line !== "") { |
NewerOlder