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
{ | |
"123":"application/vnd.lotus-1-2-3", | |
"ez":"application/andrew-inset", | |
"aw":"application/applixware", | |
"atom":"application/atom+xml", | |
"atomcat":"application/atomcat+xml", | |
"atomsvc":"application/atomsvc+xml", | |
"ccxml":"application/ccxml+xml", | |
"cdmia":"application/cdmi-capability", | |
"cdmic":"application/cdmi-container", |
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 ( | |
"errors" | |
"fmt" | |
"net" | |
) | |
func main() { |
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
pragma solidity ^0.4.24; | |
interface Token { | |
function transfer(address _to, uint256 _value) external returns (bool); | |
} | |
contract onlyOwner { | |
address public owner; | |
/** | |
* @dev The Ownable constructor sets the original `owner` of the contract to the sender |
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 -e | |
# dependecies | |
apt update | |
apt install -y git automake build-essential pkg-config libevent-dev libncurses5-dev byacc | |
# where our temp file locates | |
rm -rf /tmp/tmux |
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
// change 10 to the length desired | |
[...Array(10)].map(i=>(~~(Math.random()*36)).toString(36)).join('') |
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
// credits: https://stackoverflow.com/questions/22892120/how-to-generate-a-random-string-of-a-fixed-length-in-go | |
import ( | |
"math/rand" | |
"time" | |
) | |
const letterBytes = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" | |
const ( | |
letterIdxBits = 6 // 6 bits to represent a letter index |
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
// pkcs7strip remove pkcs7 padding | |
func pkcs7strip(data []byte, blockSize int) ([]byte, error) { | |
length := len(data) | |
if length == 0 { | |
return nil, errors.New("pkcs7: Data is empty") | |
} | |
if length%blockSize != 0 { | |
return nil, errors.New("pkcs7: Data is not block-aligned") | |
} | |
padLen := int(data[length-1]) |
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 golang:1-alpine as golang | |
RUN apk --no-cache add git zip tzdata ca-certificates | |
# avoid go path, use go mod | |
WORKDIR /app | |
COPY . . | |
RUN CGO_ENABLED=0 go build -ldflags "-s -w -extldflags "-static"" ./cmd/appnamehere | |
WORKDIR /usr/share/zoneinfo | |
# -0 means no compression. Needed because go's | |
# tz loader doesn't handle compressed data. | |
RUN zip -r -0 /zoneinfo.zip . |
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 node:10.15 as builder | |
WORKDIR /project | |
COPY . . | |
RUN npm i && npm run lint && npm run build && rm -f dist/**/*.map | |
FROM nginx:stable | |
# COPY copies folder content, not folder itself | |
COPY --from=builder /project/dist /var/www | |
COPY ./nginx.conf /etc/nginx/conf.d/default.conf |
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 | |
# preset veryslow: more time for more compressing rate | |
# -movflags +faststart optimizes for web browser so video can be played sooner. | |
# crf: small = better quality + bigger size; sane option between 17–28 | |
SRC="$1" | |
CRF="$2" | |
ffmpeg -i "$SRC" -vcodec libx264 -crf "$CRF" -movflags +faststart -preset veryslow -profile:v high -level 4.1 web_libx264_crf_${CRF}_faststart_veryslow.mp4 |
OlderNewer