Skip to content

Instantly share code, notes, and snippets.

View viktorsteinwand's full-sized avatar

Viktor Steinwand viktorsteinwand

View GitHub Profile
@viktorsteinwand
viktorsteinwand / iterm2-solarized.md
Created July 28, 2020 09:24 — forked from kevin-smets/iterm2-solarized.md
iTerm2 + Oh My Zsh + Solarized color scheme + Source Code Pro Powerline + Font Awesome + [Powerlevel10k] - (macOS)

Default

Default

Powerlevel10k

Powerlevel10k

To disable the autostart of the NCP Secure Entry Mac Client GUI application on a Mac, just edit the /Library/LaunchAgents/com.ncp-e.ncpmon.plist file and set the value "RunAtLoad" to "false" (from "true"). It's faster to do it via command-line, like this:
$ sudo nano /Library/LaunchAgents/com.ncp-e.ncpmon.plist
Then move the cursor right below the line containing "RunAtLoad" and change true to false.
Cmd+X, Y, Enter
Ready!
@viktorsteinwand
viktorsteinwand / fix-url-keys.php
Last active March 15, 2019 09:18 — forked from Vinai/fix-url-keys.php
This fixes the duplicate url_key issue in a Magento 1.8 / 1.13 installation.
<?php
/**
* Drop this into the shell directory in the Magento root and run with -h to see all options.
*/
require_once 'abstract.php';
/**
* Fix duplicate url keys for categories and products to work with the 1.8 alpha1 CE url key constraints.
@viktorsteinwand
viktorsteinwand / docx2md.md
Created September 6, 2018 10:57 — forked from vdavez/docx2md.md
Convert a Word Document into MD

Converting a Word Document to Markdown in Two Moves

The Problem

A lot of important government documents are created and saved in Microsoft Word (*.docx). But Microsoft Word is a proprietary format, and it's not really useful for presenting documents on the web. So, I wanted to find a way to convert a .docx file into markdown.

The Solution

As it turns out, there are several open-source tools that allow for conversion between file types. Pandoc is one of them, and it's powerful. In fact, pandoc's website says "If you need to convert files from one markup format into another, pandoc is your swiss-army knife." But, although pandoc can convert from markdown into .docx, it doesn't work in the other direction.

@viktorsteinwand
viktorsteinwand / sample.cs
Created August 23, 2018 14:57 — forked from dtchepak/sample.cs
SAMPLE: Sub properties using reflection
// SAMPLE ONLY -- DON'T USE FOR REAL STUFF UNLESS YOU'VE REVIEWED AND TESTED :)
// Needs work to make robust: check property type's class has default ctor and so on.
// Can also filter out interfaces as these will be auto-subbed.
public static T SubFor<T>() where T : class
{
var gettableVirtualProps = typeof(T).GetProperties()
.Where(x => x.CanRead && x.GetGetMethod().IsVirtual)
.Select(x => x);
var sub = Substitute.For<T>();
@viktorsteinwand
viktorsteinwand / IIS_Parallels_Win8_Mac.md
Created May 28, 2018 08:15 — forked from justingarrick/IIS_Parallels_Win8_Mac.md
Expose IIS or IISExpress running in a Parallels Windows 7/8 VM to your OS X host

Expose IIS or IISExpress running in a Parallels Windows 7/8 VM to your OS X host

Rename your virtual machine

In your Windows 7/8 VM, go to Control Panel > System > Advanced system settings > Computer Name and click Change. Name this whatever you like, e.g. windows. Restart your VM.

Add an ACL rule

Open CMD or Powershell as administrator. Add a URL ACL entry for your new name on the port of your choice, e.g.
netsh http add urlacl url=http://windows:8080/ user=everyone

Add a firewall rule

@viktorsteinwand
viktorsteinwand / README.md
Created June 27, 2017 19:27 — forked from ralphschindler/README.md
Docker (For Mac) De-facto Host Address Alias (10.254.254.254) - "The 10254 Trick".

Docker (Mac) De-facto Standard Host Address Alias

This launchd script will ensure that your Docker environment on your Mac will have 10.254.254.254 as an alias on your loopback device (127.0.0.1). The command being run is ifconfig lo0 alias 10.254.254.254

Installation

Copy/Paste the following in terminal with sudo (must be root as the target directory is owned by root)...

sudo curl -o /Library/LaunchDaemons/com.ralphschindler.docker_10254_alias.plist https://gist.githubusercontent.com/ralphschindler/535dc5916ccbd06f53c1b0ee5a868c93/raw/com.ralphschindler.docker_10254_alias.plist

Notice

This script is no longer required with Docker for Mac which includes an option to run Docker at startup and doesn't use docker-machine to administer the local Docker engine.

Requirements

  • Docker Machine + Docker
  • curl
  • A Virtualbox-driven Docker Machine called "default" docker-machine create --driver virtualbox default (this is the default with Docker toolkit).
@viktorsteinwand
viktorsteinwand / cleanImages.php
Created November 28, 2016 10:04 — forked from peterjaap/cleanImages.php
Script to clean up the images tables in a Magento installation. Removes references to non-existing images, removes duplicate images, sets correct default image and deletes orphaned images from the filesystem.
<?php
/*
* This script deletes duplicate images and imagerows from the database of which the images are not present in the filesystem.
* It also removes images that are exact copies of another image for the same product.
* And lastly, it looks for images that are on the filesystem but not in the database (orphaned images).
*
* This script can most likely be optimized but since it'll probably only be run a few times, I can't be bothered.
*
* Place scripts in a folder named 'scripts' (or similar) in the Magento root.
@viktorsteinwand
viktorsteinwand / le-renew-webroot
Created May 30, 2016 11:17 — forked from thisismitch/le-renew-webroot
Let's Encrypt Auto-Renewal using the Webroot Plugin (Nginx)
#!/bin/bash
web_service='nginx'
config_file="/usr/local/etc/le-renew-webroot.ini"
le_path='/opt/letsencrypt'
exp_limit=30;
if [ ! -f $config_file ]; then
echo "[ERROR] config file does not exist: $config_file"