Skip to content

Instantly share code, notes, and snippets.

Avatar

Anton Strogonoff strogonoff

View GitHub Profile
@strogonoff
strogonoff / gist:2d457d0c1681d9dedd6021e2368637c6
Last active Jul 2, 2020
Debug a production-packaged Electron app on macOS
View gist:2d457d0c1681d9dedd6021e2368637c6

In Terminal, run:

me@me:<some-app>$ ./dist/mac/<product identifier>.app/Contents/MacOS/<product identifier> --remote-debugging-port=8315
  • stdout will stream your logs and may at least give a glimpse as to where the error is thrown.
  • Open http://127.0.0.1:8315 in Chrome for some useful stuff.
@strogonoff
strogonoff / html_diff.py
Last active Sep 23, 2019
Visual differ for Metanorma flavors. Deprecated in favor of https://github.com/metanorma/visual-diff/
View html_diff.py
# Deprecated
@strogonoff
strogonoff / sparsebundle
Last active May 19, 2018 — forked from scottsb/casesafe.sh
Create and manage a case-sensitive disk-image on macOS (OS X).
View sparsebundle
#!/bin/bash
# ---------------------------------------------------------
# Customizable Settings
# ---------------------------------------------------------
MOUNT_POINT="${CASE_SAFE_MOUNT_POINT:-${HOME}/casesafe}"
VOLUME_PATH="${CASE_SAFE_VOLUME_PATH:-${HOME}/.casesafe.dmg.sparseimage}"
VOLUME_NAME="${CASE_SAFE_VOLUME_NAME:-casesafe}"
VOLUME_SIZE="${CASE_SAFE_VOLUME_SIZE:-60g}"
View keybase.md

Keybase proof

I hereby claim:

  • I am strogonoff on github.
  • I am strogonoff (https://keybase.io/strogonoff) on keybase.
  • I have a public key ASB4AETCNWMePGNNdaKxKzRKFrpXHLFkEWeewsqDyolZCAo

To claim this, I am signing this object:

View letteranimation.swift
import UIKit
import PlaygroundSupport
// https://gist.github.com/erica/6f13f3043a330359c035e7660f3fe7f5
// Original Video: https://www.youtube.com/watch?v=TTmWUSgNOHk
// Video: https://www.youtube.com/watch?v=hmAB3WJOQTU
// Video: https://www.youtube.com/watch?v=DWtavuvmKdw (with zoom and fade)
// String to animate and its attributes
var string = "Hello, playground"
let attributes: [String: Any] = [
@strogonoff
strogonoff / combined-django-querysets.py
Created Jun 13, 2014
Combine two querysets from different models in Django
View combined-django-querysets.py
import datetime
from blog.models import BlogEntry
from news.models import NewsEntry
def get_fresh_news_and_blog_entries():
u"""Returns a list containing published news entries and blog posts mixed,
sorted by publish date. Suitable for template context of, say, landing page.
"""
news = list(NewsEntry.objects.
@strogonoff
strogonoff / hnsavedsearch.py
Created Mar 12, 2014
Search your saved HN items
View hnsavedsearch.py
#coding: utf-8
u"""
Searches your saved HN items. Many false positives (overkill with synonyms).
..
$ pip install mechanize nltk
$ python hnsavedsearch.py username "space separated query"
"""
@strogonoff
strogonoff / config.js
Created Aug 5, 2013
AngularJS configuration module
View config.js
/*jslint browser: true */
/*global _: false, angular: false */
// Configuration constants. Overrides can be specified under window.settings
(function () {
'use strict';
var SETTINGS = {
apiBaseUrl: '/',
@strogonoff
strogonoff / pgessays.py
Created Nov 22, 2012 — forked from olasitarska/pgessays.py
Builds epub book out of Paul Graham's essays.
View pgessays.py
# -*- coding: utf-8 -*-
"""
Builds epub book out of Paul Graham's essays: http://paulgraham.com/articles.html
Author: Ola Sitarska <ola@sitarska.com>
This script requires python-epub-library: http://code.google.com/p/python-epub-builder/
"""
import re, ez_epub, urllib2, genshi
@strogonoff
strogonoff / middleware.py
Created Nov 16, 2011
Django middleware for cross-domain XHR. WARNING: Defaults are unsafe here. Make sure to set proper restrictions in production!
View middleware.py
from django import http
try:
from django.conf import settings
XS_SHARING_ALLOWED_ORIGINS = settings.XS_SHARING_ALLOWED_ORIGINS
XS_SHARING_ALLOWED_METHODS = settings.XS_SHARING_ALLOWED_METHODS
XS_SHARING_ALLOWED_HEADERS = settings.XS_SHARING_ALLOWED_HEADERS
XS_SHARING_ALLOWED_CREDENTIALS = settings.XS_SHARING_ALLOWED_CREDENTIALS
except AttributeError:
XS_SHARING_ALLOWED_ORIGINS = '*'
You can’t perform that action at this time.