/* ================================================================================ Pivot example with variable number of columns in the output. ================================================================================ example data is straight forward, imagine a table with a customer identifier, an invoice date and an amount. */ DROP TABLE IF EXISTS invoice;
This file contains hidden or 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
/* Ultra lightweight Github REST Client */ | |
// original inspiration via https://gist.github.com/v1vendi/75d5e5dad7a2d1ef3fcb48234e4528cb | |
const token = 'github-token-here' | |
const githubClient = generateAPI('https://api.github.com', { | |
headers: { | |
'User-Agent': 'xyz', | |
'Authorization': `bearer ${token}` | |
} | |
}) |
This file contains hidden or 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 ( | |
"crypto/aes" | |
"crypto/cipher" | |
"crypto/rand" | |
"encoding/base64" | |
"errors" | |
"io" | |
"log" |
This file contains hidden or 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
-- When SQLite is compiled with the JSON1 extensions it provides builtin tools | |
-- for manipulating JSON data stored in the database. | |
-- This is a gist showing SQLite return query data as a JSON object. | |
-- https://www.sqlite.org/json1.html | |
-- An example table with some data | |
CREATE TABLE users ( | |
id INTEGER PRIMARY KEY NOT NULL, | |
full_name TEXT NOT NULL, | |
email TEXT NOT NULL, |
This is an example usage of registering an update_hook
to a SQLite connection. The motivation for exploring this feature is to test out various implementations of data monitoring interfaces.
A few notable properties of the implementation:
- The hook must be registered on the connection being used which requires clients to manually integrate this code.
- Each
INSERT
andUPDATE
operation requires a subsequentSELECT
to get the row data. - When registering the hook, increasing the
bufsize
under heavy workloads will improve throughput, but the SQLite library is single-threaded by design.
A list of useful commands for the ffmpeg command line tool.
Download FFmpeg: https://www.ffmpeg.org/download.html
Full documentation: https://www.ffmpeg.org/ffmpeg.html
This file contains hidden or 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
// poller.go | |
package main | |
import ( | |
"fmt" | |
"os" | |
"os/signal" | |
"time" |
This file contains hidden or 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
var url = "[email protected]:nodegit/test.git"; | |
var opts = { | |
fetchOpts: { | |
callbacks: { | |
certificateCheck: () => 0, | |
credentials: function(url, userName) { | |
return NodeGit.Credential.sshKeyNew( | |
userName, | |
sshPublicKeyPath, | |
sshPrivateKeyPath, |
This file contains hidden or 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 getBoundingBox(data) { | |
var bounds = {}, coordinates, point, latitude, longitude; | |
// Loop through each "feature" | |
for (var i = 0; i < data.features.length; i++) { | |
coordinates = data.features[i].geometry.coordinates; | |
if(coordinates.length === 1){ | |
// It's only a single Polygon | |
// For each individual coordinate in this feature's coordinates... |
This file contains hidden or 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
// This shows an example of how to generate a SSH RSA Private/Public key pair and save it locally | |
package main | |
import ( | |
"crypto/rand" | |
"crypto/rsa" | |
"crypto/x509" | |
"encoding/pem" | |
"golang.org/x/crypto/ssh" |