Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000
// | |
// Library.swift | |
// LabelLayout | |
// | |
// Created by Chris Eidhof on 09.09.18. | |
// Copyright © 2018 objc.io. All rights reserved. | |
// | |
import UIKit |
import Foundation | |
extension URLRequest { | |
/** | |
Returns a cURL command representation of this URL request. | |
*/ | |
public var curlString: String { | |
guard let url = url else { return "" } | |
var baseCommand = #"curl "\#(url.absoluteString)""# |
# | |
# Notes: | |
# | |
# I used the following AMI: | |
# "Amazon Linux AMI 2015.09.1 (HVM), SSD Volume Type - ami-60b6c60a" | |
# Running on AMI: amzn-ami-hvm-2015.09.1.x86_64-gp2 (ami-60b6c60a) | |
# | |
# You probably want to use an instance type with a large amount of memory. My first | |
# attempt was with a c4.2xlarge but it rant out of memory without using -j option to | |
# limit the parallel build. |
#! /usr/bin/ruby | |
require 'pathname' | |
platform = "iphonesimulator" # or "macosx" | |
contents_xcplayground = <<XML | |
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> | |
<playground version='1.0' sdk='#{platform}'> | |
<sections> | |
<code source-file-name='section-1.swift'/> | |
</sections> |
typedef enum _UIBackgroundStyle { | |
UIBackgroundStyleDefault, | |
UIBackgroundStyleTransparent, | |
UIBackgroundStyleLightBlur, | |
UIBackgroundStyleDarkBlur, | |
UIBackgroundStyleDarkTranslucent | |
} UIBackgroundStyle; | |
@interface UIApplication (UIBackgroundStyle) | |
-(void)_setBackgroundStyle:(UIBackgroundStyle)style; |
Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000
// | |
// AppDelegate.m | |
// CallSuperMethod | |
// | |
#import <objc/objc-runtime.h> | |
#import "AppDelegate.h" | |
@interface Superclass : NSObject | |
- (NSString*)a; |
-- show running queries (pre 9.2) | |
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query | |
FROM pg_stat_activity | |
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%' | |
ORDER BY query_start desc; | |
-- show running queries (9.2) | |
SELECT pid, age(clock_timestamp(), query_start), usename, query | |
FROM pg_stat_activity | |
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%' |
require 'net/http' | |
# WARNING do not use this; it works but is very limited | |
def resolve url | |
res = Net::HTTP.get_response URI(url) | |
if res.code == '301' then res['location'] | |
else url.to_s | |
end | |
end |
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
# CUI Downloader of "Command Line Tools for Xcode" | |
# by Akihiro Uchida, CC0 dedicated to the public domain | |
# see http://creativecommons.org/publicdomain/zero/1.0/ | |
import sys, os | |
import urllib, urllib2, cookielib | |
from getpass import getpass | |
from HTMLParser import HTMLParser |