All of the following information is based on go version go1.17.1 darwin/amd64.
| GOOS | Out of the Box |
|---|---|
aix |
✅ |
android |
✅ |
| package main | |
| import ( | |
| "fmt" | |
| "net/http" | |
| "net/http/httputil" | |
| "net/url" | |
| "github.com/gin-gonic/gin" | |
| ) |
| # Use this script to test that your Telegram bot works. | |
| # | |
| # Install the dependency | |
| # | |
| # $ gem install telegram_bot | |
| # | |
| # Run the bot | |
| # | |
| # $ ruby bot.rb | |
| # |
| // 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]) |
| // +build windows | |
| //go:generate go build -ldflags "-s -w -extldflags '-static'" $GOFILE | |
| package main | |
| import ( | |
| "fmt" | |
| "syscall" | |
| "unsafe" | |
| ) |
| { | |
| "content_scripts": [ | |
| { | |
| "matches": ["http://*/*", "https://*/*"], | |
| "js": ["inject.js"], | |
| "all_frames": true | |
| } | |
| ], | |
| "web_accessible_resources": [ | |
| "content.js" |
| # The initial version | |
| if [ ! -f .env ] | |
| then | |
| export $(cat .env | xargs) | |
| fi | |
| # My favorite from the comments. Thanks @richarddewit & others! | |
| set -a && source .env && set +a |
| FILE SPACING: | |
| # double space a file | |
| sed G | |
| # double space a file which already has blank lines in it. Output file | |
| # should contain no more than one blank line between lines of text. | |
| sed '/^$/d;G' |
| var crypto = require('crypto') | |
| , fs = require('fs') | |
| // Algorithm depends on availability of OpenSSL on platform | |
| // Another algorithms: 'sha1', 'md5', 'sha256', 'sha512' ... | |
| var algorithm = 'sha1' | |
| , shasum = crypto.createHash(algorithm) | |
| // Updating shasum with file content | |
| var filename = __dirname + "/anything.txt" |
| #!/usr/bin/env bash | |
| # | |
| # usage: JWT_SECRET="silly" mk-jwt-token | |
| # @WARN: modify the payload and header to your needs. | |
| # | |
| main(){ | |
| set -eo pipefail | |
| [ -n "$JWT_SECRET" ] || die "JWT_SECRET environment variable is not set." |