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
package main | |
import ( | |
"bytes" | |
"os" | |
"github.com/rs/zerolog/log" | |
"golang.org/x/crypto/ssh" | |
) |
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
public class DeadlockExample { | |
public static void main(String[] args) { | |
Object lock1 = new Object(); | |
Object lock2 = new Object(); | |
Thread thread1 = new Thread(() -> { | |
synchronized (lock1) { | |
System.out.println("Thread 1: Acquired lock1"); | |
try { | |
Thread.sleep(1000); |
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
package com.tutorial.hello; | |
import com.tutorial.hello.HelloOuterClass.Hello; | |
import java.io.FileOutputStream; | |
import java.io.IOException; | |
import java.util.ArrayList; | |
import java.util.HashMap; | |
import java.util.List; | |
import java.util.Map; |
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 flask import Flask, Response, current_app, jsonify, make_response | |
from flask.views import MethodView | |
def create_app() -> Flask: | |
"""Create application context.""" | |
created_app = Flask(__name__) | |
return created_app |
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 datetime import datetime, timezone | |
from typing import Any, Optional, Sequence, Type | |
from sqlalchemy import ( | |
DateTime, | |
Dialect, | |
ForeignKey, | |
Result, | |
Row, | |
String, |
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 queue import Queue | |
from threading import Thread | |
from time import sleep | |
# https://docs.python.org/3/library/queue.html | |
# https://stackoverflow.com/questions/27200674/python-queue-join | |
# https://stackoverflow.com/questions/7445742/runtimeerror-thread-init-not-called-when-subclassing-threading-thread | |
_TASK_QUEUE = Queue() |
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
package main | |
import ( | |
"fmt" | |
) | |
type Sudoku = [9][9]int | |
func main() { | |
unsolved := Sudoku{ |
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 stately.base import State | |
from stately.enums import PersonStateKey | |
_INITIAL_STAMINA = 5 | |
_WALKING_EFFORT = 2 | |
_RUNNING_EFFORT = 3 | |
_RESTING_POWER = 5 | |
# Placed Person here to avoid cyclic dependencies. The con though is that too |
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
root = true | |
[*] | |
indent_size = 2 | |
indent_style = space |
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 numpy as np | |
# https://numpy.org/doc/stable/user/quickstart.html | |
def main(): | |
# a_reshape (3 x 5) | |
a_reshape: np.ndarray = np.arange(15).reshape(3, 5) | |
assert a_reshape.shape == (3, 5) | |
assert a_reshape.ndim == 2 | |
assert a_reshape.dtype.name == "int64" |
NewerOlder