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
func Test$NAME$(t *testing.T) { | |
type args struct { | |
$ARGS$ | |
} | |
type want struct { | |
$WANT$ | |
} | |
test := func(args args, want want) func(t *testing.T) { | |
return func(t *testing.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
package quicksort | |
import ( | |
"math/rand" | |
"sync" | |
) | |
func Sort(xs []int) []int { | |
if len(xs) < 2 { | |
return xs |
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
module Main where | |
import Data.List (intercalate) | |
digitToWord :: Int -> String | |
digitToWord 0 = "zero" | |
digitToWord 1 = "one" | |
digitToWord 2 = "two" | |
digitToWord 3 = "three" | |
digitToWord 4 = "four" |
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
echo 'Waiting for an HTTP endpoint to return 2xx' | |
until $(curl --output /dev/null --silent --fail $1); do | |
printf '.' | |
sleep 5 | |
done | |
echo 'Success!' |
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 | |
import cv2 | |
args = { | |
'prototxt': 'deploy.prototxt.txt', | |
'model': 'res10_300x300_ssd_iter_140000.caffemodel', | |
'confidence': 0.5 | |
} | |
net = cv2.dnn.readNetFromCaffe(args["prototxt"], args["model"]) |
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
#include <stdio.h> | |
#include <stdlib.h> | |
#include "linkedlist.h" | |
void display(node *head) { | |
node *it; | |
for (it = head; it != NULL; it = it->next) | |
printf(it->next != NULL ? "%d " : "%d\n", it->data); | |
} |
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 rest_framework_jwt.serializers import VerifyJSONWebTokenSerializer | |
class JwtTokenAuthMiddleware: | |
""" | |
JWT token authorization middleware for Django Channels 2 | |
""" | |
def __init__(self, inner): | |
self.inner = inner |
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
def float2bin(x, eps=1e-9): | |
res = '' | |
while x > eps: | |
x *= 2 | |
res += str(int(x)) | |
x -= int(x) | |
return res | |