Skip to content

Instantly share code, notes, and snippets.

@cantino
cantino / base64-md5-test.rb
Created February 28, 2019 23:41
Four ways to compute the base64 md5 checksum used by ActiveStorage
require 'digest'
# From activestorage
def compute_checksum_in_chunks(io)
Digest::MD5.new.tap do |checksum|
while chunk = io.read(5242880)
checksum << chunk
end
io.rewind
end.base64digest
@hernan43
hernan43 / annoy-o-bug.ino
Last active April 28, 2018 21:42
I took various bits and pieces from the included projects and combined them to create an Annoy-O-Bug that conserves power by using the ATTiny85's built in watchdog timer.
/*
ATTiny85 Annoy-O-Bug
This is equal parts:
https://create.arduino.cc/projecthub/arjun/programming-attiny85-with-arduino-uno-afb829
https://www.hackster.io/AlexWulff/the-annoy-o-bug-a-chirping-light-up-throwie-37e58a
https://github.com/sparkfun/H2OhNo/blob/master/firmware/WatchDogTest/WatchDogTest.ino
https://github.com/SpenceKonde/ATTinyCore
@ssokolow
ssokolow / screenshot.png
Last active April 22, 2020 13:47
Simple script to streamline the process of updating a Retrode's firmware on Linux
screenshot.png

Live stream Xiaomi Ants Smart Camera via FFMPEG

This assumes you have a Xiaomi Ants Smart Camera that still has the open RTSP enabled. I think newer firmware might remove this capability. If you Google enough you can find instructions on how to downgrade.

FFMPEG

FFMPEG is where most of the magic happens. I use OSX and as such am a fan of using Homebrew to install free software. Here is my ffmpeg install command:

brew install ffmpeg --with-faac --with-fdk-aac --with-ffplay --with-fontconfig --with-freetype --with-frei0r --with-libass --with-libbluray --with-libcaca --with-libquvi --with-libsoxr --with-libssh --with-libvidstab --with-libvorbis --with-libvpx --with-opencore-amr --with-openjpeg --with-openssl --with-opus --with-rtmpdump --with-schroedinger --with-speex --with-theora --with-tools --with-webp --with-x265

@afknapping
afknapping / .bashrc
Created May 14, 2014 15:59
bash aliases for wtf did i do today (and yesterday)
alias wtf-did-i-do-yesterday="echo '' && echo 'wtf did i do yesterday?' && echo '' && git log --pretty=format:'%Cred%h%Creset - %s%Creset - %Cgreen%cd%Creset ' --date=relative --all --since=2.days.ago --until=1.day.ago --author=\"$(git config user.name)\""
alias wtf-did-i-do-today="echo '' && echo 'wtf did i do today?' && echo '' && git log --pretty=format:'%Cred%h%Creset - %s%Creset - %Cgreen%cd%Creset ' --date=relative --all --since=6am --author=\"$(git config user.name)\""
# the aliases need escaped double quotes
# to try the commands directly, copy this and paste into your terminal:
# echo '' && echo 'wtf did i do today?' && echo '' && git log --pretty=format:'%Cred%h%Creset - %s%Creset - %Cgreen%cd%Creset ' --date=relative --all --since=6am --author="$(git config user.name)"
@alertor
alertor / jira-behing-nginx-ssl
Last active April 27, 2023 15:45
Atlassian JIRA behind nginx + SSL
# force HTTP to HTTPS - /etc/nginx/conf.d/nonssl.conf
server {
listen 80;
server_name jira.example.com;
access_log off;
return 301 https://$server_name$request_uri;
}
# /etc/nginx/conf.d/jira.conf
server {
@dergachev
dergachev / GIF-Screencast-OSX.md
Last active July 17, 2024 14:20
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@EtienneDepaulis
EtienneDepaulis / main.css
Created September 20, 2012 21:11
Full-screen mode on a Crocodoc iFrame
#overlay{
background: #000 repeat top left;
position:fixed;
top:0px;
bottom:0px;
left:0px;
right:0px;
z-index:100;
}
@robinsloan
robinsloan / langoliers.rb
Last active June 25, 2024 17:12
The Langoliers, a tweet deletion script
require "rubygems"
require "twitter"
require "json"
# things you must configure
TWITTER_USER = "your_username"
MAX_AGE_IN_DAYS = 1 # anything older than this is deleted
# get these from dev.twitter.com
CONSUMER_KEY = "your_consumer_key"
@jedy
jedy / go_scp.go
Last active May 31, 2022 07:20
an example of scp in golang
// https://blogs.oracle.com/janp/entry/how_the_scp_protocol_works
package main
import (
"fmt"
"golang.org/x/crypto/ssh"
)
const privateKey = `content of id_rsa`