Skip to content

Instantly share code, notes, and snippets.

Avatar

Marc Belmont marcbelmont

View GitHub Profile
@marcbelmont
marcbelmont / image_viewer.py
Last active Nov 13, 2020
Browser based image viewer. Display all the images from a directory as thumbnails on a webpage.
View image_viewer.py
#! /usr/bin/python3
import argparse
import imghdr
import webbrowser
from http.server import HTTPServer, SimpleHTTPRequestHandler
from os import chdir
from pathlib import Path
from urllib.parse import parse_qs, urlparse
@marcbelmont
marcbelmont / platerec_lookup_memory.py
Last active Oct 11, 2020
Use in-memory image in Plate Recognizer and other speed tricks.
View platerec_lookup_memory.py
import io
import json
import requests
from PIL import Image
def main():
im = Image.new('RGB', (300, 300))
# or
@marcbelmont
marcbelmont / tornado_rollbar.py
Created Jul 7, 2020
Use Rollbar with Tornado Web
View tornado_rollbar.py
import tornado.ioloop
import tornado.web
class MyRequestHandler(tornado.web.RequestHandler):
def log_exception(self, typ, value, tb):
rollbar.report_exc_info((typ, value, tb))
super().log_exception(typ, value, tb)
@marcbelmont
marcbelmont / portal_knights.cfg
Created Jun 14, 2020
Portal Knights Linux Fix. `Protal Knights/protal_knights.cfg` may not be created when on Linux. You may copy this one.
View portal_knights.cfg
{
"gamebuild": "",
"graphics": {
"api": "Direct3D11",
"adapterPlatformId": "32902,354,0,0",
"displayName": "\\\\.\\DISPLAY1",
"width": 2560,
"height": 1080,
"refreshRateNumerator": 60,
"refreshRateDenominator": 1,
@marcbelmont
marcbelmont / webhook_reader.py
Last active Feb 8, 2021
Plate Recognizer: How to Receive Webhook Data.
View webhook_reader.py
"""
This script is now available from
https://github.com/marcbelmont/deep-license-plate-recognition/tree/master/webhooks
"""
@marcbelmont
marcbelmont / spotify-ad-muter.tampermonkey.js
Last active Mar 28, 2021
Spotify Ad Muter. Automatically mute (block) Spotify ads. Turn sound on again after the ad.
View spotify-ad-muter.tampermonkey.js
// ==UserScript==
// @name Spotify Ad Muter
// @version 1.1
// @namespace http://tampermonkey.net/
// @description Detects and blocks ads on Spotify. Automatically mute Spotify ads. Turn sound on again after the ad.
// @match https://*.spotify.com/*
// @grant none
// @run-at document-start
// @downloadURL https://gist.github.com/marcbelmont/1ea63270867a4e8786dd5f172d8d4489/raw
// @updateURL https://gist.github.com/marcbelmont/1ea63270867a4e8786dd5f172d8d4489/raw
@marcbelmont
marcbelmont / unicode_icons.py
Last active Nov 24, 2020
Add Unicode Icons to Ranger File Manager. 🖼️ 📂 🎵 🥳
View unicode_icons.py
# Unicode Icons in Ranger File Manager
#
# How to install?
# https://gist.github.com/marcbelmont/c12d2fd2519a372d3b347f665b37e74a#gistcomment-3240106
from __future__ import absolute_import, division, print_function
from itertools import repeat
import ranger.api
View keybase.md

Keybase proof

I hereby claim:

  • I am marcbelmont on github.
  • I am marcemile (https://keybase.io/marcemile) on keybase.
  • I have a public key ASBAQ4uMeCYD353vGrasriJsy1LIKcSajl89Mfux2_8ClAo

To claim this, I am signing this object:

View ParallelCriterionSkip.lua
local ParallelCriterionSkip, parent = torch.class('nn.ParallelCriterionSkip', 'nn.Criterion')
function ParallelCriterionSkip:__init(repeatTarget)
parent.__init(self)
self.criterions = {}
self.weights = {}
self.gradInput = {}
self.repeatTarget = repeatTarget
end
@marcbelmont
marcbelmont / gist:5259298
Created Mar 28, 2013
Extract Skype chats / conversations from preferences (main.db file), convert them to html and send them to an email using Gmail stmp.
View gist:5259298
# -*- coding: utf-8 -*-
"""
Skype database access functionality.
@author Erki Suurjaak
@created 26.11.2011
@modified 07.03.2013
"""
import copy
import csv