Skip to content

Instantly share code, notes, and snippets.

@wacko
wacko / gist:5577187
Last active January 6, 2024 07:31
SSH between Mac OS X host and Virtual Box guest

On Mac OS (host):

Shutdown your VM and do:

VirtualBox > Settings > Network > Add (you will get vboxnet0)

On a terminal ifconfig will show you new interface vboxnet0

VM's Settings > System > check "Enable I/O APIC." VM's Settings > Network > Adapter 2 > host-only vboxnet0

@pims
pims / app.py
Last active January 3, 2024 20:26
Example of running a python script via python-wasi using the wasmtime wasm runtime
print("hello from a python script")
@zevaverbach
zevaverbach / main.js
Last active November 20, 2023 06:55
Get remaining time in a Teachable course
// I created this for (and tested it on) a learn.cantrill.io course
// to quickly determine how much more video I have left to finish the course,
// so I could plan my time in advance of an AWS exam.
function getTotalMinutesLeftInCourse() {
let totalMinutes = 0;
for (const chapter of getChapters()) {
if (!chapterIsComplete(chapter)) {
const [minutes, seconds] = getMinutesAndSeconds(getLengthString(chapter.innerText))
@RobertAudi
RobertAudi / ideavimrc
Created July 28, 2014 08:46
System clipboard support in IdeaVim
nnoremap yy "+yy
vnoremap y "+y
nnoremap p "+p
vnoremap p "+p
nnoremap P "+P
vnoremap P "+P
@baumandm
baumandm / GIF-Screencast-OSX.md
Last active November 3, 2023 07:18 — forked from dergachev/GIF-Screencast-OSX.md
OS X Screencast to Animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime and ffmpeg.

Forked from https://gist.github.com/dergachev/4627207. Updated to use a palette to improve quality and skip gifsicle.

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@r00k
r00k / vimrc
Last active May 13, 2023 09:34
A minimal vimrc for beginners
" A minimal vimrc for new vim users to start with.
"
" Referenced here: http://www.benorenstein.com/blog/your-first-vimrc-should-be-nearly-empty/
" Original Author: Bram Moolenaar <Bram@vim.org>
" Made more minimal by: Ben Orenstein
" Last change: 2012 Jan 20
"
" To use it, copy it to
" for Unix and OS/2: ~/.vimrc
@jorinvo
jorinvo / challenge.md
Last active April 21, 2023 17:14
This is a little challenge to find out which tools programmers use to get their everyday tasks done quickly.

You got your hands on some data that was leaked from a social network and you want to help the poor people.

Luckily you know a government service to automatically block a list of credit cards.

The service is a little old school though and you have to upload a CSV file in the exact format. The upload fails if the CSV file contains invalid data.

The CSV files should have two columns, Name and Credit Card. Also, it must be named after the following pattern:

YYYYMMDD.csv.

@oldo
oldo / video-metada-finder.py
Last active March 2, 2023 22:33
A python function utilising `ffprobe` to find any metadata related to a video file. Examples of what it can find include bitrate, fps, codec details, duration and many more. This gist returns the video height and width as an example.
#!/usr/local/bin/python3
import subprocess
import shlex
import json
# function to find the resolution of the input video file
def findVideoMetada(pathToInputVideo):
cmd = "ffprobe -v quiet -print_format json -show_streams"
args = shlex.split(cmd)
args.append(pathToInputVideo)
@jiaaro
jiaaro / hotkey_helpers.js
Last active February 27, 2023 22:01
Mac Automation – Javascript (JSX) Hotkey helpers
// How to use:
// 1. Open "Script Editor" (requires OS X 10.10 Yosemite)
// 2. Change the language from "AppleScript" to "JavaScript"
// 3. Paste the code below and replace the safari example.
//
// More info:
// https://developer.apple.com/library/mac/releasenotes/InterapplicationCommunication/RN-JavaScriptForAutomation/index.html
var sys_events = Application("System Events");
# -*- coding: utf-8 -*-
import os
import sys
from flask.ext.script import Command, Option
class GunicornServer(Command):
"""Run the app within Gunicorn"""