Skip to content

Instantly share code, notes, and snippets.

@Wtower
Wtower / README.md
Created January 1, 2019 21:59
OpenVPN for Windows: Map network drives at connect

OpenVPN for Windows: Map network drives at connect

Create two batch files as below. They need to be in the same directory as the .ovpn OpenVPN configuration file (eg. \Users\Wtower\OpenVPN) and be named with the same name filename, but appending _up and _down.

@gemmadlou
gemmadlou / 01-introduction.md
Last active May 3, 2024 06:38
WordPress Composer Starter (Steps)

Develop WordPress as a Modern PHP Project with Composer


WordPress is popular because it's easy to setup without much technical know-how. However, to build a more robust PHP project with command line deployments, updates and ongoing maintenance, working with WordPress out-of-the-box raises specific challenges:


  • How can we make our WordPress projects portable between developers?
@Wtower
Wtower / README.md
Last active January 27, 2020 10:23
Setup dev environment with VSCode on Windows

Setup dev environment with VSCode on Windows

This gist is intended to guide on how to setup a dev environment in Windows 7 for developers coming from a Linux background.

For Windows 10 see file win10.md below.

Install

@Wtower
Wtower / README.rst
Last active January 17, 2019 16:11
Ubuntu Gnome 17.04: after installation

Ubuntu Gnome 17.04: After installation

What to after installing Ubuntu Gnome 17.04.

Wifi Gnome issue

Due to a known bug with this version of network manager, Gnome can't connect to wifi networks:

@Elijas
Elijas / findLastUsedRowsAndCols.py
Last active January 22, 2022 21:00
xlwings find used range boundaries (last used row and last used column)
import xlwings as xl
import xlwings.constants
s = xl.Book('doc.xlsx').sheets[0]
RR2 = s.api.Cells.Find(What="*",
After=s.api.Cells(1, 1),
LookAt=xlwings.constants.LookAt.xlPart,
LookIn=xlwings.constants.FindLookIn.xlFormulas,
SearchOrder=xlwings.constants.SearchOrder.xlByRows,
SearchDirection=xlwings.constants.SearchDirection.xlPrevious,
@macbookandrew
macbookandrew / findStyles.js
Last active March 30, 2024 15:24
List unique CSS properties for all DOM elements
/**
* List unique CSS properties for all DOM elements
* Initially created to list unique font stacks on a page
* @see {@link http://stackoverflow.com/a/35022690/ Inspired by this StackOverflow answer}
*
* @see {@link https://gist.github.com/macbookandrew/f33dbbc0aa582d0515919dc5fb95c00a/ URL for this file}
*
* @author AndrewRMinion Design (https://andrewrminion.com)
* @version 1.1
*
@Wtower
Wtower / install.sh
Created September 14, 2016 10:51
Toradex install prerequisites and flash
#!/bin/bash
# install programs:
sudo apt-get install gksu gtkterm
# run terminal:
gksu gtkterm
# extract image iso:
bzip2 -d Colibri_VF_LinuxImageV2.6Beta2_20160630.tar.bz2
@lgyanf
lgyanf / add_query_parameters.py
Created June 14, 2016 10:49
A python decorator that adds query parameters to django-rest-framework swagger docstring.
# -*- coding: utf-8 -*-
import collections
import yaml
from rest_framework import fields
"""
Convert rest_framework.fields classes to Swagger data types according to http://swagger.io/specification/
Return 'string' by default.
@Wtower
Wtower / README.rst
Last active December 8, 2020 06:16
Bi-directional many-to-many relationship in django admin

Accessing a ManyToMany relationship from both ends

Based on the article Related ManyToManyField in Django admin site, the file forms.py contains a summary of the recommended code.

The file manytomany.py contains a generic base class in order to be DRY and avoid repeating the same code in many form classes.

An example of how to use can be found in the NineCMS project commit 52c710f.

@Wtower
Wtower / config.fish
Last active October 20, 2022 21:47
Using fish shell with python virtualenv, node nvm and ansible
# Greeting prologue
echo "Welcome to "(uname -a | awk '{print $1 " " $2 " " $3 " " $4 " " $12}')
uptime
# ansible
. ~/workspace/ansible/ansible/hacking/env-setup.fish -q > /dev/null ^&1
set -Ux ANSIBLE_INVENTORY ~/workspace/ansible/play/hosts
echo "Now using "(ansible --version | head -n 1 | awk '{print $1 " " $2}')
# Load virtual fish