Skip to content

Instantly share code, notes, and snippets.

View andreif's full-sized avatar
👾
invading spaces

Andrei Fokau andreif

👾
invading spaces
View GitHub Profile
@webframp
webframp / keybase.md
Created July 25, 2017 18:14
Signing git commits on github using keybase.io gpg key

Probably one of the easiest things you'll ever do with gpg

Install Keybase: https://keybase.io/download and Ensure the keybase cli is in your PATH

First get the public key

keybase pgp export | gpg --import

Next get the private key

import requests
import sys
import json
def waybackurls(host, with_subs):
if with_subs:
url = 'http://web.archive.org/cdx/search/cdx?url=*.%s/*&output=json&fl=original&collapse=urlkey' % host
else:
url = 'http://web.archive.org/cdx/search/cdx?url=%s/*&output=json&fl=original&collapse=urlkey' % host
@jamieweavis
jamieweavis / macos-app-icon.md
Last active April 25, 2024 13:26
How to create an .icns macOS app icon
@matteomattei
matteomattei / test_http.py
Last active July 8, 2021 05:55
HTTP/HTTPS GET and POST (including files) with built-in python modules
#!/usr/bin/env python3
# This script performs a GET and a POST request through HTTP/HTTPS using
# builtin python3 moudules. There is also a class to encode files for upload!
import urllib.request
import http.client
import mimetypes
import codecs
import uuid
import binascii
// TextView subclass that replicates TVOS movies app
// Also made a quick presentation controller
// Just connect the delegate to the ViewController in IB
// and set the TextView class to FocusTextView
import UIKit
class TextPresentationViewController:UIViewController {
let label = UILabel()
let blurStyle = UIBlurEffectStyle.Dark
@jstoiko
jstoiko / gist:5492f8baa69c1722b984
Created June 12, 2015 20:02
Using tox, pyenv and multiple version of python on OSX

Install pyenv using homebrew:

$ brew install pyenv

Install multiple versions of python:

$ pyenv install 3.2.6 3.3.6 3.4.3
chrome.webRequest.onHeadersReceived.addListener(
function (details) {
for (var i = 0; i < details.responseHeaders.length; ++i) {
if (details.responseHeaders[i].name.toLowerCase() == 'x-frame-options') {
details.responseHeaders.splice(i, 1);
return {
responseHeaders: details.responseHeaders
};
}
}
@danielnorton
danielnorton / AttributedRoundtrip.m
Last active August 9, 2016 13:56
Unexpected roundtrip of HTML through NSAttributedString. This demonstrates a simple HTML file going into an NSAttributedString and then writing that string back out to a new HTML file. The output file is structured very differently than the input file. This was discovered while experimenting with using a UITextView as a rich text editor.
- (NSAttributedString *)loadContent {
NSString *filePath = [[NSBundle mainBundle] pathForResource:@"input" ofType:@"html"];
NSData *htmlData = [NSData dataWithContentsOfFile:filePath];
NSDictionary *options = @{
NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType,
NSCharacterEncodingDocumentAttribute: @(NSUTF8StringEncoding)
};
@grenade
grenade / 01-generate-ed25519-ssh-key.sh
Last active April 14, 2024 14:27
generate ed25519 ssh and gpg/pgp keys and set file permissions for ssh keys and config
#!/bin/bash
# generate new personal ed25519 ssh key
ssh-keygen -o -a 100 -t ed25519 -f ~/.ssh/id_ed25519 -C "rob thijssen <rthijssen@gmail.com>"
# generate new host cert authority (host_ca) ed25519 ssh key
# used for signing host keys and creating host certs
ssh-keygen -t ed25519 -f manta_host_ca -C manta.network
eval "$(ssh-agent -s)"
@smoser
smoser / ubuntu-cloud-virtualbox.sh
Last active April 2, 2024 21:07
example of using Ubuntu cloud images with virtualbox
## Install necessary packages
$ sudo apt-get install virtualbox-ose qemu-utils genisoimage cloud-utils
## get kvm unloaded so virtualbox can load
$ sudo modprobe -r kvm_amd kvm_intel
$ sudo service virtualbox stop
$ sudo service virtualbox start
## URL to most recent cloud image of 12.04
$ img_url="http://cloud-images.ubuntu.com/server/releases/12.04/release"