Skip to content

Instantly share code, notes, and snippets.

🐤
building my own birdfeeder on here

Suz Hinton noopkat

🐤
building my own birdfeeder on here
View GitHub Profile
@aribornstein
aribornstein / FetchAzureBlobContainer.js
Created Mar 17, 2019
Fetch Azure Blob Container List JS
View FetchAzureBlobContainer.js
fetch("https://{namespace}.blob.core.windows.net/{containerName}/?restype=container&comp=list")
.then(response => response.text())
.then(str => new window.DOMParser().parseFromString(str, "text/xml"))
.then(xml => {
let blobList = Array.from(xml.querySelectorAll("Url")); //.getAttribute("Url");
blobList.forEach(async blobUrl => {
console.log(blobUrl);
});
View autoupdate_nerdtree.vim
function! NERDTreeFindUpdate()
if exists("t:NERDTreeBufName") && bufwinnr(t:NERDTreeBufName) != -1 && expand("%:p") =~ getcwd() && !exists("b:fugitive_type")
:NERDTreeFind
exec "normal! \<c-w>p"
endif
endfunction
augroup nerd
autocmd!
autocmd BufReadPost * call NERDTreeFindUpdate()
View yank_position.vim
" ----------------------------------------------------------------------------
" Yank Position
" ----------------------------------------------------------------------------
function! s:YankPosition()
let @+=@%.'#L'.line('.')
let @r=@%
echo 'copied "'.@+.'"'
endfunction
nnoremap <silent> yp :call <sid>YankPosition()<CR>
@kentcdodds
kentcdodds / comments.js
Created Apr 3, 2018
A handy trick with multiline code comments I learned from Matt Zabriskie
View comments.js
// here's a handy trick:
/*
console.log('any code')
/**/
// It takes just one character change
View 0 basics.md

A series of posts on css-in-js

0. styles as objects

First, an exercise. Can we represent all of css with plain data? Let's try.

let redText = { color: 'red' };
@moritzmhmk
moritzmhmk / rpi_camera_v4l2_ffmpeg.md
Last active Jun 11, 2020
using raspberry pi camera with ffmpeg (hardware accelerated)
View rpi_camera_v4l2_ffmpeg.md

Using Raspberry Pi Camera with ffmpeg

Capturing video from the rpi camera with ffmpeg can vary from less than 5% to 100% of the CPU (rpi zero) depending on ffmpeg using the hardware acceleration or not.

On many github issues one finds the suggestion of using h264_omx codec to use the gpu - but it does not ship with the default ffmpeg on Raspbian.

Instead I found that one can use the v4l2 driver provided by raspbian to get hardware accelerated h264 output. Also setting the video size will save one from using a (cpu) scale filter.

ffmpeg

capture h264 video from rpi camera

View promises_for_noopkat.js
client
.refresh()
.then(function () {
return client.get(); // return your promise
})
.then(function (result) {
// result is the return of client.get()
})
.catch(function (err) {
// common handler for any broken promise now
@indrayam
indrayam / create-jwt-using-unix-commands-on-mac.md
Last active May 20, 2020
Create JWT Token Header Using Unix Command line tools ONLY!
View create-jwt-using-unix-commands-on-mac.md

Pseudocode:

Y = Base64URLEncode(Header) + ‘.’ + Base64URLEncode(Payload)
JWT = Y + ‘.’ + Base64URLEncode(HMACSHA256(Y))

The steps called out here should work on a Mac as well. The only thing that might be different is the sed command used below. Instead of using -E, you will have to use -r to run sed with extended regular expression support

Use data from this tutorial:

scotch.io

View Microsoft.Powershell_profile.ps1
Push-Location (Split-Path -Path $MyInvocation.MyCommand.Definition -Parent)
Import-Module "posh-svn"
Import-Module "svn"
function global:prompt {
$realLASTEXITCODE = $LASTEXITCODE
Write-Host "PS $($executionContext.SessionState.Path.CurrentLocation)" -nonewline
Write-VcsStatus
@nucleartide
nucleartide / explicit.js
Last active Mar 25, 2019
Explicit Go-style error handling with ES6 destructuring. No more try-catch!
View explicit.js
function explicit(ctx, fn) {
return function() {
try {
const result = fn.apply(ctx, arguments)
return [null, result]
} catch (err) {
return [err, null]
}
}
You can’t perform that action at this time.