Skip to content

Instantly share code, notes, and snippets.

View revmischa's full-sized avatar
🇺🇦

Mischa Spiegelmock revmischa

🇺🇦
View GitHub Profile
@revmischa
revmischa / open_iot_security_cert.md
Created June 13, 2017 02:42
Open IoT Security Certification Draft

Level I - Basic

Network

Software/Firmware

  • No default username/password
    • Devices must not ship with a well-known username and/or password
      • Unless the password must be changed on first use No backdoor passwords in firmware. This can be dumped and reversed and published.
@revmischa
revmischa / myapp.py
Last active November 19, 2021 01:31
Deferred jobs with sqlalchemy/flask/apscheduler
# sample usage:
class MyFlaskApp(Flask):
...
def start_heartbeat(self):
"""Schedule periodic heartbeat updates."""
if hasattr(self, 'heartbeat_sched'):
raise Exception("Heartbeat already started")
sched = self.get_scheduler()
self.heartbeat_sched = sched
@revmischa
revmischa / xml2json.xslt
Last active October 17, 2016 20:08
XSLT to convert XML TO JSON (lol)
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!--
Copyright (c) 2006,2008 Doeke Zanstra
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this
"""Mass invite users from one channel to another."""
from slacker import Slacker
from pprint import pprint
slack = Slacker('xxxxx')
me = slack.auth.test().body
me_id = me['user_id']
#!/usr/bin/env perl
# convert postgres slow query log query w/ separate 'parameters:' line into an executable EXPLAIN ANALYZE query
use strict;
use warnings;
use Data::Dump qw/ddx/;
my $qfile = shift @ARGV or die "query file required";
@revmischa
revmischa / shitlink.pl
Last active November 11, 2015 02:29
Irssi script to prevent clicking of low-quality links on the internet
#!/bin/bash
# usage: bin/slackmsg "blah blah blah" => #engineering
# escape message for JSON:
MSG=$(printf '%q' $*)
echo $MSG
PAYLOAD="payload={\"channel\": \"#engineering\", \"username\": \"engbot\", \"text\": \"$MSG\", \"icon_emoji\": \":shipit:\"}"
echo $PAYLOAD
@revmischa
revmischa / gist:0ac56ddd2026ca1d05ee
Last active August 29, 2015 14:06
Hello world, linux x86 assembly version
.section .rodata
.hellostr:
.string "Hello, world\n"
.text
.globl _start
_start:
pushq %rbp
movq %rsp, %rbp
@revmischa
revmischa / install-plenv.sh
Last active July 12, 2022 02:25
Set up plenv, install perl, cpanm, carton, set up environment
#!/bin/bash
# installs plenv, perl, carton, cpanminus, sets up environment in .bash_profile
# from https://github.com/tokuhirom/plenv#readme
PLENV_PERL_VERSION='5.18.1'
if [[ -n "$PERL_MB_OPT" ]]; then
echo "You must unset your local::lib environment variables first"
0000000100000f2e subq $8, %rsp
0000000100000f32 xorl %r12d, %r12d
0000000100000f35 leaq 68(%rip), %r14
0000000100000f3c movl $42, %r15d
new_line:
0000000100000f42 movswl (%r14,%r12,2), %r13d
0000000100000f47 xorl %ebx, %ebx
new_col:
0000000100000f49 btl %ebx, %r13d
0000000100000f4d movl $95, %edi