Skip to content

Instantly share code, notes, and snippets.

@marcelkornblum
marcelkornblum / child.html
Last active October 17, 2022 08:11
iFrame with dynamic resizing based on child dimensions
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<title>iFrame Child</title>
<script type="text/javascript" src="iframe-messenger.js"></script>
</head>
<body>
@marcelkornblum
marcelkornblum / sync-time
Created April 1, 2020 15:56
BASH script to sync WSL clock with host. You run into API auth errors when they get out of sync due to the distro sleeping
#!/bin/bash
# Syncs the WSL clock with the machine clock - they get out of sync after suspension
sudo hwclock -s
@marcelkornblum
marcelkornblum / bulk-transfer-repos.py
Last active March 10, 2024 16:14
Simple Python script to rip everything from BitBucket across to Github with minimal interaction
# heavily inspired by https://gist.github.com/rbellamy/3c5033ba605a090824e8
# gets everything from bitbucket and brings it across to GH, adding LFS where necessary for file size
# then archives everything brought over
#
# runs on Python 3; does clone --mirror and push --mirror, cleaning up after itself
#
# you need git-lfs installed on the local system
# also make sure you've got git credential caching set up https://help.github.com/articles/caching-your-github-password-in-git/
import json
@marcelkornblum
marcelkornblum / export_repo_issues_to_csv.py
Last active December 18, 2023 20:20 — forked from unbracketed/export_repo_issues_to_csv.py
Export Issues from Github repo to CSV (API v3)
"""
This is strongly based on https://gist.github.com/unbracketed/3380407;
thanks to @unbracketed and the various commenters on the page.
I've mainly cleaned up the code into basic methods, and included the
various suggestions in the comments. Hope this is useful to someone.
Make sure you have `requests` and `csv` installed via pip then run it:
`python export_gh_issues_to_csv.py`
@marcelkornblum
marcelkornblum / stringToDate.js
Last active April 7, 2016 10:07
Fairly naive JS function for guessing a date from a variety of natural language strings. Includes regexes!
function getDateFromString( input ) {
var d = new Date();
var this_year = d.getUTCFullYear();
var date_obj = new Date(input); // try just the default
if ( _.isDate(date_obj) && _.isFinite(date_obj.getTime()) && date_obj.getUTCFullYear() >= this_year ) { // well that was easy
return date_obj;
}
input_int = _.parseInt(input);
@marcelkornblum
marcelkornblum / keybase.md
Last active March 17, 2016 21:28
keybase.io verification

Keybase proof

I hereby claim:

  • I am marcelkornblum on github.
  • I am marcelkornblum (https://keybase.io/marcelkornblum) on keybase.
  • I have a public key whose fingerprint is CD16 1BA8 6339 9AE3 3A94 311F 82D9 F4FC 3376 8263

To claim this, I am signing this object:

Keybase proof

I hereby claim:

  • I am marcelkornblum on github.
  • I am marcelkornblum (https://keybase.io/marcelkornblum) on keybase.
  • I have a public key whose fingerprint is 5ACA 3399 AA6B 2D62 6778 E81F CCC6 F1C2 DD3B 3546

To claim this, I am signing this object:

@marcelkornblum
marcelkornblum / .profile
Created January 13, 2015 14:26
auto-completion for ssh config
_complete_ssh_hosts ()
{
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
comp_ssh_hosts=`cat ~/.ssh/known_hosts | \
cut -f 1 -d ' ' | \
sed -e s/,.*//g | \
grep -v ^# | \
uniq | \
grep -v "\[" ;
@marcelkornblum
marcelkornblum / post-checkout
Created October 27, 2014 16:33
Post-checkout git hook for local PY coding. It will remove all .pyc files after a checkout, which can cause problems otherwise. Put this code into ~/.git/hooks/post-checkout and then chmod +x ~/.git/hooks/post-checkout from this directory.
#!/usr/bin/env bash
# Delete .pyc files and empty directories from root of project
cd ./$(git rev-parse --show-cdup)
# Clean-up
find . -name ".DS_Store" -delete
NUM_PYC_FILES=$( find . -name "*.pyc" | wc -l | tr -d ' ' )
if [ $NUM_PYC_FILES -gt 0 ]; then
@marcelkornblum
marcelkornblum / app.js
Created November 7, 2013 15:23
AngularJS Class Provider (wrapper for John Resig's Simple Object Inheritance Class at https://github.com/tracker1/core-js/blob/master/js-extensions/040-Class.js)
angular.module('myApp', ['class']);