Skip to content

Instantly share code, notes, and snippets.

@johan
johan / sandbox-breaker.js
Created August 23, 2010 10:39
Breaks out of the Greasemonkey / Google Chrome user script sandbox and runs the code in the page scope instead, free of sandbox gotchas and deprived of all privileged API:s.
// This block of code injects our source in the content scope and then calls the
// passed callback there. The whole script runs in both GM and page content, but
// since we have no other code that does anything, the Greasemonkey sandbox does
// nothing at all when it has spawned the page script, which gets to use jQuery.
// (jQuery unfortunately degrades much when run in Mozilla's javascript sandbox)
(function(run_me_in_page_scope) {
if ('undefined' == typeof __RUNS_IN_PAGE_SCOPE__) { // unsandbox, please!
var src = arguments.callee.caller.toString(),
script = document.createElement('script');
script.setAttribute("type", "application/javascript");
@hiltmon
hiltmon / merge_asana_into_omnifocus.rb
Created November 3, 2013 22:49
Merge Asana Projects, Tasks and SubTasks into OmniFocus
#!/usr/bin/env ruby
# merge_asana_into_omnifocus.rb
# Hilton Lipschitz
# http://www.hiltmon.com
# Use and modify freely, attribution appreciated
# Script to import Asana projects and their tasks into
# OmniFocus and keep them up to date from Asana.
@timkuijsten
timkuijsten / sshsock
Last active April 10, 2018 20:43
Quick 'n dirty VPN for macOS
#!/bin/sh
# sshsock - Quick 'n dirty VPN for macOS
#
# Usage example:
# Let Apple Mail, Safari and Firefox route all traffic via your ssh server at
# foo.example.com by using a system-wide local SOCKS proxy:
#
# $ sshsock foo.example.com
# Password:
#!/bin/bash
# Run this script just before you put the laptop in the bin for security scanning.
# You can add the seconds the laptop will be waiting before speaking. The default
# is waiting for 180 seconds (3 minutes).
# Switch to the login screen, effectively locking the screen.
function lockscreen() {
/System/Library/CoreServices/"Menu Extras"/User.menu/Contents/Resources/CGSession -suspend
}
@3demax
3demax / tabbar-tweak.el
Created October 5, 2011 14:58
Emacs tabbar-mode visual tweaks
;; This are setting for nice tabbar items
;; to have an idea of what it looks like http://imgur.com/b0SNN
;; inspired by Amit Patel screenshot http://www.emacswiki.org/pics/static/NyanModeWithCustomBackground.png
;; Tabbar
(require 'tabbar)
;; Tabbar settings
(set-face-attribute
'tabbar-default nil
:background "gray20"
<!DOCTYPE html>
<html>
<head>
<title>First React App</title>
<script crossorigin src="https://unpkg.com/react@16/umd/react.development.js"></script>
<script crossorigin src="https://unpkg.com/react-dom@16/umd/react-dom.development.js"></script>
<script src='https://unpkg.com/babel-standalone@6/babel.min.js'></script>
</head>
<body>
<div id='app'></div>
@rcarmo
rcarmo / puppeteer.js
Last active January 10, 2022 03:49
Trying to get a single-page PDF screenshot out of puppeteer
const puppeteer = require('puppeteer');
function sleep(ms){
return new Promise(resolve=>{
setTimeout(resolve,ms)
})
}
(async() => {
@SiccarPoint
SiccarPoint / fix_html_xml.sh
Last active October 12, 2022 09:09
Clean up an imported reference xml in Zotero that contains bad html tags from e.g. Papers3 export
# Guaranteed for mac only due to syntax of sed function, but changes for
# other OS should be minor.
# Ensure you have sqlite3 on your machine.
# Remember to set unix permissions on this file before running:
# chmod 755 fix_html_xml.sh
# and run:
# ./fix_html_xml.sh
# This script should run clean! If you see errors, it won't have worked.
# Will probably take a while to run (mins)
@milankorsos
milankorsos / redux-actions.ts
Last active November 10, 2022 10:58
Correct TypeScript typing example for Redux Thunk actions
import {Action, ActionCreator, Dispatch} from 'redux';
import {ThunkAction} from 'redux-thunk';
// Redux action
const reduxAction: ActionCreator<Action> = (text: string) => {
return {
type: SET_TEXT,
text
};
};
@mihaitodor
mihaitodor / foo_names.md
Created July 9, 2016 22:05
Map slugs to course names

https://archive.org/download/archiveteam_coursera_20160627114043/coursera_20160627114043.megawarc.warc.gz

  • bigdata = Web Intelligence and Big Data
  • clinical skills = Teaching and Assessing Clinical Skills
  • comp finance = Introduction to Computational Finance and Financial Econometrics
  • data sci = Introduction to Data Science
  • dmathgen = 离散数学概论 Discrete Mathematics Generality
  • global introuslaw = The Global Student's Introduction to U.S. Law
  • global theatre = Theatre and Globalization
  • global theatre = Theatre and Globalization
  • inforiskman = Information Security and Risk Management in Context