This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var BASE64_MARKER = ';base64,'; | |
function convertDataURIToBinary(dataURI) { | |
var base64Index = dataURI.indexOf(BASE64_MARKER) + BASE64_MARKER.length; | |
var base64 = dataURI.substring(base64Index); | |
var raw = window.atob(base64); | |
var rawLength = raw.length; | |
var array = new Uint8Array(new ArrayBuffer(rawLength)); | |
for(i = 0; i < rawLength; i++) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var fsDoOverwrite = true // Overwrite file with base64 code | |
var fsAsASCII = false // Create base64 code file as ASCII file | |
var adTypeBinary = 1 // Binary file is encoded | |
function encode(from, to) { | |
var inputStream = WScript.CreateObject("ADODB.Stream"); | |
inputStream.Type = adTypeBinary | |
inputStream.Open(); | |
inputStream.LoadFromFile(from); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import email, getpass, imaplib, os | |
detach_dir = '.' # directory where to save attachments (default: current) | |
user = raw_input("Enter your GMail username:") | |
pwd = getpass.getpass("Enter your password: ") | |
# connecting to the gmail imap server | |
m = imaplib.IMAP4_SSL("imap.gmail.com") | |
m.login(user,pwd) | |
m.select("cs2043") # here you a can choose a mail box like INBOX instead |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright @ Bjarte Johansen 2012 | |
# License: http://ljos.mit-license.org/ | |
from AppKit import NSApplication, NSApp, NSWorkspace | |
from Foundation import NSObject, NSLog | |
from PyObjCTools import AppHelper | |
from Quartz import kCGWindowListOptionOnScreenOnly, kCGNullWindowID, CGWindowListCopyWindowInfo | |
class AppDelegate(NSObject): | |
def applicationDidFinishLaunching_(self, notification): |
SSH into your EC2 instance. Run the following:
$ sudo yum install gcc
This may return an "already installed" message. That's OK.
$ wget http://download.redis.io/redis-stable.tar.gz && tar xvzf redis-stable.tar.gz && cd redis-stable && make
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Flexbox styles so Safari respects position: relative; on the flex item. | |
*/ | |
.flex-box { | |
display: flex; | |
} | |
.flex-item { | |
display: flex; /* Fixes Safari issue with position: relative; */ |
This gist had a far larger impact than I imagined it would, and apparently people are still finding it, so a quick update:
- TC39 is currently moving forward with a slightly different version of TLA, referred to as 'variant B', in which a module with TLA doesn't block sibling execution. This vastly reduces the danger of parallelizable work happening in serial and thereby delaying startup, which was the concern that motivated me to write this gist
- In the wild, we're seeing
(async main(){...}())
as a substitute for TLA. This completely eliminates the blocking problem (yay!) but it's less powerful, and harder to statically analyse (boo). In other words the lack of TLA is causing real problems - Therefore, a version of TLA that solves the original issue is a valuable addition to the language, and I'm in full support of the current proposal, which you can read here.
I'll leave the rest of this document unedited, for archaeological
Using perf:
$ perf record -g binary
$ perf script | stackcollapse-perf.pl | rust-unmangle | flamegraph.pl > flame.svg
NOTE: See @GabrielMajeri's comments below about the
-g
option.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import sys | |
import json | |
import os | |
import os.path | |
import shutil | |
import logging | |
import tempfile | |
import glob | |
import argparse |
OlderNewer