Skip to content

Instantly share code, notes, and snippets.

View smitmartijn's full-sized avatar

Martijn Smit smitmartijn

View GitHub Profile
chrome.runtime.onMessage.addListener(function (message, sender, sendResponse) {
if (message.action === "googleMeetBringToFront") {
chrome.tabs.query({}, function (tabs) {
let meetFound = false;
for (let i = 0; i < tabs.length; i++) {
if (tabs[i].url.includes('meet.google.com')) {
meetFound = true;
chrome.tabs.update(tabs[i].id, { selected: true });
chrome.windows.update(tabs[i].windowId, { focused: true });
@smitmartijn
smitmartijn / install.sh
Created February 26, 2024 12:52
Installing TailwindCSS with VuePress v1
npm uninstall tailwindcss postcss autoprefixer
npm install tailwindcss@npm:@tailwindcss/postcss7-compat postcss@^7 autoprefixer@^9
@smitmartijn
smitmartijn / laravel-tmuxp.yaml
Created August 10, 2023 09:19
Run a Laravel app in a tiled tmux window with a single command.
# brew install tmuxp
# tmuxp load tmuxp.yaml
session_name: laravel-app
windows:
- window_name: laravel-app
layout: tiled
panes:
- docker-compose -f docker-compose.yml up
- php artisan serve
- npm run dev
@smitmartijn
smitmartijn / ApiSearchController.php
Created April 11, 2023 15:13
Laravel API token authentication
/**
* Laravel's Sanctum is not great at validating bearer tokens.
* If you want to validate a token for more than "does it exist", you need to do it manually.
* Here's an example inside an controller:
*/
class ApiSearchController extends Controller
{
public function store(Request $request)
{
import asyncio
from Smile import Smile
import json
async def main():
smile = Smile("192.168.0.0", "password")
await smile.connect()
await smile.update_locations()
# Get the current power consumption in watts
@smitmartijn
smitmartijn / app.js
Created November 11, 2022 15:54
MuteDeck Stream Deck Plugin
/* global $CC, Utils, $SD */
/* THIRD PARTY */
// https://github.com/joewalnes/reconnecting-websocket/blob/master/reconnecting-websocket.js
(function(global, factory) {
if (typeof define === 'function' && define.amd) {
define([], factory);
} else if (typeof module !== 'undefined' && module.exports) {
module.exports = factory();
} else {
@smitmartijn
smitmartijn / fontawesome4to5.py
Created December 27, 2021 14:22
More complete font awesome v4 to v5 migration
import os
from collections import OrderedDict
findreplace = [
('fa fa-500px', 'fab fa-500px'),
('fa fa-address-book-o', 'far fa-address-book'),
('fa fa-address-card-o', 'far fa-address-card'),
('fa fa-adn', 'fab fa-adn'),
('fa fa-amazon', 'fab fa-amazon'),
('fa fa-android', 'fab fa-android'),
@smitmartijn
smitmartijn / vra-action-reconfigure-servers.py
Created November 8, 2021 12:00
vRealize Automation Action that reconfigures server after deployment
#
# This script can be used as an action inside vRealize Automation to handle
# logging into deployed servers after deployment.
#
# It's provided as-is. If you'd like to use it, there are multiple changes needed.
# I.e. vraUrl to point to your own vRA. The username that's used to SSH. The way it decides
# which servers to log into.
#
# Martijn Smit <martijn@lostdomain.org>
# https://lostdomain.org
@smitmartijn
smitmartijn / howToModifyOvaFile.md
Created March 21, 2021 17:59 — forked from goodjob1114/howToModifyOvaFile.md
how to modify .ova file on linux/Mac using terminal....export vm (OVF 1.0) from virtualbox, then modify some tag and hash value for import vm to ESXi

extract ova files from an archive

$ tar -xvf vmName.ova

modify ovf for some invalid tag

$ vi vmName.ovf
{
"data_filter": {
"snmp": true,
"smtp": true,
"data_sources": true,
"events": true,
"syslog": true,
"ldap": true,
"vidm": true,
"user_data": true,