Skip to content

Instantly share code, notes, and snippets.

View snobu's full-sized avatar

Adrian Calinescu snobu

View GitHub Profile
@snobu
snobu / superblink.hex
Last active March 30, 2018 15:44
superblink.hex
@snobu
snobu / fwupdate.md
Last active April 1, 2018 08:30
firmware update

Storage devices may incorporate wear leveling transparently as part of the storage controller logic, in which case this problem is taken care of by the storage device manufacturer. This is the case for most mid- to high-end storage devices. For example, all SD cards have a storage controller that takes wear leveling into account.

Many cheaper or older storage devices do not have wear leveling built in, however, and then wear leveling should be handled at the operating system level. This type of storage is often referred to as "raw flash", and in Linux it makes use of the Memory Technology Device (MTD) subsystem to implement wear leveling.

When working with raw flash devices, Unsorted Block Images (UBI) (which is similar in purpose to Logical Volume Manager (LVM)) and UBIFS can be used to implement wear leveling.

^From mender.io

Download FAIL-PROOF OVER THE AIR FIRMWARE UPGRADE FOR EMBEDDED SYSTEMS

@snobu
snobu / app.py
Created May 20, 2018 11:12
falcon-testing
#!/usr/bin/env python3
import falcon
from images import Resource
api = application = falcon.API()
images = Resource(None)
api.add_route('/images', images)
@snobu
snobu / predictions
Created June 5, 2018 23:24
predictions object
[(b'dog', 0.9854100346565247, (0.6142047643661499, 0.7815952897071838, 0.6484081745147705, 0.4332994222640991)), (b'tvmonitor', 0.975887656211853, (0.3882329761981964, 0.2098638117313385, 0.24332229793071747, 0.14483867585659027)), (b'tvmonitor', 0.9517174363136292, (0.1433017998933792, 0.1828109622001648, 0.2707240879535675, 0.3058007061481476)), (b'tvmonitor', 0.9072312116622925, (0.13514330983161926, 0.8300702571868896, 0.25722625851631165, 0.30114850401878357)), (b'dog', 0.8628168106079102, (0.6264531016349792, 0.2714015245437622, 0.4155009686946869, 0.39503735303878784)), (b'keyboard', 0.6453257203102112, (0.1492997258901596, 0.4130619466304779, 0.31321650743484497, 0.08949316293001175))]
//https://github.com/kubernetes/kops/issues/1726#issuecomment-299748490
spec:
hooks:
- name: nvidiagpu
manifest: |-
Type=oneshot
ExecStartPre=/usr/bin/docker pull kopeio/nvidia-bootstrap:1.6
ExecStart=-/usr/bin/docker run -v /:/rootfs/ -v /var/run/dbus:/var/run/dbus -v /run/systemd:/run/systemd --net=host --privileged kopeio/nvidia-bootstrap:1.6
ExecStop=/bin/systemctl restart kubelet
@snobu
snobu / deploy.sh
Last active July 4, 2018 08:53
App Service notes
# Deploy to App Service Windows
# -----------------------------
# Download the web app binaries as .zip
wget https://athensdata.blob.core.windows.net/pub/site.zip
# Set the SITE_NAME variable to read the name of your web app
export SITE_NAME=your-site-name
# Deploy the .zip file to the web app
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.1</TargetFramework>
<RootNamespace>iothub_serviceclient</RootNamespace>
<LangVersion>7.3</LangVersion>
</PropertyGroup>
<ItemGroup>
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'BallmerDance.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf56.40.101
Duration: 00:01:14.35, start: 0.000000, bitrate: 345 kb/s
Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 240x176 [SAR 1:1 DAR 15:11], 244 kb/s, 30 fps, 30 tbr, 90k tbn, 60 tbc (default)
Metadata:
handler_name : VideoHandler
@snobu
snobu / gist:442b4b90f600ae283f72ad7714e1c838
Created August 3, 2018 13:50
ffmpeg-stream-to-media-services
ffmpeg -stream_loop -1 -i .\INPUT_FILE.webm -strict -2 -c:a aac -b:a 128k -ar 44100 \
-r 24 -g 60 -keyint_min 48 -b:v 1500000 -c:v libx264 -preset medium -bufsize 1500k -maxrate 1500k \
-f flv rtmp://livedrm-amsd-euwe.channel.media.azure.net:1935/live/66eexxxxxxxxxxxxx5231f59e/mystream1
@snobu
snobu / mqttjs-iothub.js
Last active August 7, 2018 10:51
mqtt.js-iothub
var MQTT = require("async-mqtt");
const deviceId = "TheDeviceId";
const iotHubName = "poorlyfundedskynet";
const userName = `${iotHubName}.azure-devices.net/${deviceId}/api-version=2016-11-14`;
const iotHubTopic = `devices/${deviceId}/messages/events/`;
const sas = `SharedAccessSignature sr=${iotHubName}.azure-devices.net%2Fdevices%2F${deviceId}&sig=THeSignaTurE&se=1565174493`;
var client = MQTT.connect(`mqtts://${iotHubName}.azure-devices.net:8883`, {
keepalive: 10,