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 ( | |
"fmt" | |
"log" | |
"time" | |
) | |
func main() { | |
queue := NewQueue("amqp://guest:guest@localhost:5672/", "hello") |
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
if [[ $OSTYPE == "darwin"* ]]; then | |
full_size=$(find $build_dir ! -type d -print0 | xargs -0 stat -f '%z' | awk '{sum += $1} END{print sum}') | |
else | |
full_size=$(du -sb $build_dir | awk '{print $1}') | |
fi |
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 formatBytes(bytes,decimals) { | |
if(bytes == 0) return '0 Bytes'; | |
var k = 1024, | |
dm = decimals || 2, | |
sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'], | |
i = Math.floor(Math.log(bytes) / Math.log(k)); | |
return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i]; | |
} | |
// Usage: |
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
node -e "console.log(require('crypto').randomBytes(256).toString('base64'));" |
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 chalk = require('chalk'); | |
/** | |
* Adds mark check symbol | |
*/ | |
function addCheckMark(callback) { | |
process.stdout.write(chalk.green(' ✓')); | |
if (callback) callback(); | |
} |
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 readline = require('readline'); | |
/** | |
* Adds an animated progress indicator | |
* | |
* @param {string} message The message to write next to the indicator | |
* @param {number} amountOfDots The amount of dots you want to animate | |
*/ | |
function animateProgress(message, amountOfDots) { | |
let i = 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 logging | |
import ( | |
"github.com/rs/zerolog" | |
"github.com/rs/zerolog/log" | |
"gopkg.in/natefinch/lumberjack.v2" | |
"os" | |
"path" | |
"io" | |
) |
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 "os" | |
func createDirIfNotExists(path string) error { | |
if _, err := os.Stat(path); os.IsNotExist(err) { | |
return os.Mkdir(path, os.ModeDir|0755) | |
} | |
return nil | |
} |
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 React, { useRef, useReducer } from 'react' | |
import { fetchJson } from 'apis' | |
export function useFetchWithCache({ | |
url, | |
options, | |
}) { | |
const cache = useRef({}) |
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
select service_broker_guid,* from sys.databases | |
ALTER DATABASE TEST_AUDIOKLAN SET NEW_BROKER WITH ROLLBACK IMMEDIATE; |
NewerOlder