Skip to content

Instantly share code, notes, and snippets.

@miguelmota
miguelmota / crypto.go
Last active November 2, 2022 21:19
Golang SHA256 hash example
package crypto
import (
"crypto/sha256"
)
// NewSHA256 ...
func NewSHA256(data []byte) []byte {
hash := sha256.Sum256(data)
return hash[:]
@kitze
kitze / store-wrapper.js
Last active April 28, 2022 13:45
mobx store wrapper for storybook
import React from 'react';
import {Provider} from 'mobx-react';
const stub = () => true;
export const exampleStore = {
app: {},
auth: {
checkAuth: stub
},
@PDegenPortnoy
PDegenPortnoy / csshX example
Created December 5, 2013 20:33
Use example of csshX to start multiple, simultaneous, interactive SSH sessions
pdp-mbp: ~ $ cat hostlist.txt
sfo-crawl-4
sfo-crawl-5
sfo-crawl-6
sfo-crawl-7
sfo-crawl-8
sfo-crawl-9
sfo-crawl-11
sfo-crawl-14
pdp-mbp: ~ $ csshX --host hostlist.txt
@tomazursic
tomazursic / InfluxDB_cheatsheet.md
Last active December 24, 2021 08:46
InfluxDB cheatsheet

InfluxDB Cheatsheet

Connect to InfluxDB using the commandline:

$ influx

Create a database foo:

CREATE DATABASE foo
@sanusart
sanusart / localStorage.js
Last active August 1, 2020 09:03
Jest mock localStorage #test #jest
// ./__mocks__/localStorage.js
let mockStorage = {};
module.exports = window.localStorage = {
setItem: (key, val) => Object.assign(mockStorage, {[key]: val}),
getItem: (key) => mockStorage[key],
clear: () => mockStorage = {}
};
@manuhabitela
manuhabitela / compile.js
Last active September 4, 2019 08:51
Checking environment in (node) Sass
#!/usr/bin/env node
var fs = require('fs');
var path = require('path');
var sass = require('node-sass');
var ENV = process.env.SASS_ENV || 'development';
var file = 'variables.scss';
//if in dev, directly pass file to sass
if (ENV === "development") {