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 rustlang/rust:nightly as builder | |
WORKDIR /app/src | |
RUN USER=root cargo new --bin ht | |
COPY Cargo.toml Cargo.lock ./ht/ | |
WORKDIR /app/src/ht | |
RUN cargo build --release | |
COPY ./ ./ | |
RUN cargo build --release |
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 google.cloud import bigquery | |
""" | |
Use this to convert an online BigQuery dataset's table schema into a PostgreSQL (eg. on CloudSQL) CREATE TABLE command. | |
""" | |
def get_table_schema(project_name, dataset_name, table_name): | |
"""Return 'project_name.dataset_name.table_name''s BigQuery table schema object.""" | |
bq_client = bigquery.Client(project=project_name) |
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
using System; | |
using System.Collections.Generic; | |
using System.Configuration; | |
using System.Data; | |
using System.Diagnostics; | |
using System.Diagnostics.Contracts; | |
using System.Globalization; | |
using System.Linq; | |
using System.Linq.Expressions; | |
using System.Threading.Tasks; |
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
<!DOCTYPE html> | |
<head> | |
<meta charset="utf-8"> | |
<title>d3 depth chart</title> | |
<script type="text/javascript" src="https://d3js.org/d3.v4.min.js"></script> | |
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/[email protected]/lodash.min.js"></script> | |
<style> |
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
# http://soundfile.sapp.org/doc/WaveFormat/ | |
import struct | |
def parse_wave_raw(filename): | |
# Open the example wave file stored in the current directory. | |
with open(filename, 'rb') as wav_file: | |
# Main Header | |
chunk_id = wav_file.read(4) | |
assert chunk_id == b'RIFF', 'RIFF little endian, RIFX big endian: assume RIFF' |
First of all, please note that token expiration and revoking are two different things.
- Expiration only happens for web apps, not for native mobile apps, because native apps never expire.
- Revoking only happens when (1) uses click the logout button on the website or native Apps;(2) users reset their passwords; (3) users revoke their tokens explicitly in the administration panel.
A JWT token that never expires is dangerous if the token is stolen then someone can always access the user's data.
Quoted from JWT RFC:
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 ( | |
"encoding/json" | |
"fmt" | |
"log" | |
"net/http" | |
"strings" | |
"time" |
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 'package:flutter/material.dart'; | |
import 'package:flutter/rendering.dart'; | |
import 'package:intl/intl.dart' hide TextDirection; | |
void main() { | |
runApp(new ChartDemo()); | |
} | |
class ChartDemo extends StatelessWidget { | |
@override |
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
use std::net; | |
use std::env; | |
fn listen(socket: &net::UdpSocket, mut buffer: &mut [u8]) -> usize { | |
let (number_of_bytes, src_addr) = socket.recv_from(&mut buffer).expect("no data received"); | |
println!("{:?}", number_of_bytes); | |
println!("{:?}", src_addr); |