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
#!/usr/bin/env bash | |
set -eu | |
dockerfile=$(mktemp) | |
trap "rm $dockerfile" EXIT | |
cat << EOF > $dockerfile | |
FROM ubuntu:bionic | |
RUN apt-get update && apt-get install -y wget gnupg2 |
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
zypper-download | |
=============== | |
Downloads packages using any amount of available openSUSE mirrors. | |
Installation | |
------------ | |
Copy both files to the following locations: |
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
// Singly-linked lists are already defined with this interface: | |
// function ListNode(x) { | |
// this.value = x; | |
// this.next = null; | |
// } | |
// | |
function addTwoHugeNumbers(a, b) { | |
var sum = null, | |
tmp, | |
carry = 0, |
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 util | |
import ( | |
"errors" | |
"fmt" | |
"net" | |
) | |
// useful links: | |
// https://stackoverflow.com/questions/27410764/dial-with-a-specific-address-interface-golang |
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
const admin = require('firebase-admin'); | |
const fs = require('fs'); | |
const serviceAccount = require('../../../../../../Private/myschool-data_transfer-key.json'); | |
admin.initializeApp({ credential: admin.credential.cert(serviceAccount) }); | |
const schema = require('./schema').schema; | |
const firestore2json = (db, schema, current) => { |
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 ( | |
"strings" | |
) | |
func main() { | |
strings.HasPrefix("foobar", "foo") // true | |
} |
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
(defun my-fancy-startup-screen (&rest args) | |
(clear-image-cache) | |
(let* ((pwidth (window-pixel-width)) | |
(pheight (* pwidth 0.75)) | |
(file (expand-file-name "~/some-background.jpg")) | |
(tfile "/tmp/emacs-splash.jpg") | |
(color "white") | |
(font "/usr/share/fonts/corefonts/times.ttf") | |
(rt (/ pwidth 1000.0)) | |
(size1 (* 80.0 rt)) (size2 (* 16.0 rt)) (size3 (* 24.0 rt)) |
Using py.test is great and the support for test fixtures is pretty awesome. However, in order to share your fixtures across your entire module, py.test suggests you define all your fixtures within one single conftest.py
file. This is impractical if you have a large quantity of fixtures -- for better organization and readibility, you would much rather define your fixtures across multiple, well-named files. But how do you do that? ...No one on the internet seemed to know.
Turns out, however, you can define fixtures in individual files like this:
tests/fixtures/add.py
import pytest
@pytest.fixture
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
function randomChoice(arr) { | |
return arr[Math.floor(Math.random() * arr.length)]; | |
} |
NewerOlder