Skip to content

Instantly share code, notes, and snippets.

View noopkat's full-sized avatar
🐤
building my own birdfeeder on here

Suz Hinton noopkat

🐤
building my own birdfeeder on here
View GitHub Profile
@mikeesto
mikeesto / hotspot.md
Last active April 19, 2023 07:47
Create a local WiFi hotspot with a Raspberry Pi with custom routing

Create a local WiFi hotspot with custom routing on the Raspberry Pi

This setup lets you:

  • SSH into the Pi directly (e.g. ssh pi@raspberrypi)
  • Access things running on the Pi (e.g. a web server)
  • Set up fun domains that only exist within the local network, and can route to your services running on the Pi
  • Prevents any access to the internet which can be useful if you are running the Pi as a tech demo, or for teaching etc

This is a modified/shorter version from the official Pi docs.

@aribornstein
aribornstein / FetchAzureBlobContainer.js
Created March 17, 2019 10:19
Fetch Azure Blob Container List 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);
});
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()
" ----------------------------------------------------------------------------
" 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 April 3, 2018 15:16
A handy trick with multiline code comments I learned from Matt Zabriskie
// here's a handy trick:
/*
console.log('any code')
/**/
// It takes just one character change
@threepointone
threepointone / 0 basics.md
Last active March 21, 2023 01:53
css-in-js

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 December 17, 2023 20:45
using raspberry pi camera with ffmpeg (hardware accelerated)

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

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 September 21, 2022 08:08
Create JWT Token Header Using Unix Command line tools ONLY!

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

@nucleartide
nucleartide / explicit.js
Last active March 25, 2019 15:08
Explicit Go-style error handling with ES6 destructuring. No more try-catch!
function explicit(ctx, fn) {
return function() {
try {
const result = fn.apply(ctx, arguments)
return [null, result]
} catch (err) {
return [err, null]
}
}