Skip to content

Instantly share code, notes, and snippets.

@thenewguy
thenewguy / hotspot-keep-alive.ps1
Created May 7, 2024 20:07 — forked from primaryobjects/hotspot-keep-alive.ps1
Script to Enable Windows 10 Mobile Hotspot Automatically After Reboot
# https://superuser.com/a/1434648
Add-Type -AssemblyName System.Runtime.WindowsRuntime
$asTaskGeneric = ([System.WindowsRuntimeSystemExtensions].GetMethods() | ? { $_.Name -eq 'AsTask' -and $_.GetParameters().Count -eq 1 -and $_.GetParameters()[0].ParameterType.Name -eq 'IAsyncOperation`1' })[0]
Function Await($WinRtTask, $ResultType) {
$asTask = $asTaskGeneric.MakeGenericMethod($ResultType)
$netTask = $asTask.Invoke($null, @($WinRtTask))
$netTask.Wait(-1) | Out-Null
$netTask.Result
@thenewguy
thenewguy / admin.py
Created June 23, 2022 14:48 — forked from gauravvjn/admin.py
Use JSONField properties in Django admin filter Raw
"""
More details on the implementation and usage can be found at
https://www.pyscoop.com/django-jsonfield-attributes-in-admin-filter/
"""
from django.contrib import admin
from django.core.exceptions import ImproperlyConfigured
class JSONFieldFilter(admin.SimpleListFilter):
@thenewguy
thenewguy / sendmail-bluemix
Created April 7, 2021 21:15 — forked from lgaetz/sendmail-bluemix
Asterisk voicemail mailcmd script for VM transcription
#!/bin/sh
# sendmail-bluemix
# current verison of this script: https://gist.github.com/lgaetz/2cd9c54fb1714e0d509f5f8215b3f5e6
#
#
# Original source created by N. Bernaerts: https://github.com/NicolasBernaerts/debian-scripts/tree/master/asterisk
# modified per: https://jrklein.com/2015/08/17/asterisk-voicemail-transcription-via-ibm-bluemix-speech-to-text-api/
#
#
@thenewguy
thenewguy / sendmail-gcloud
Created April 7, 2021 21:09 — forked from tony722/sendmail-gcloud
Freepbx Voicemail Transcription Script: Google Speech API
#!/bin/sh
# sendmail-gcloud
#
# Installation instructions
# Copy the content of this file to /usr/sbin/sendmail-gcloud
#
# Google Account
# ---------------
# Create a Google Cloud account if you don't have one yet. Free trial is available at https://console.cloud.google.com/freetrial
@thenewguy
thenewguy / README.markdown
Created July 8, 2020 13:48 — forked from jasoncodes/README.markdown
Run VMware Fusion headless at Mac OS system startup

Run VMware Fusion headless at Mac OS system startup.

I heard you like headless VMs on your Mac so I wrote this script for your launchds.

Assumptions

  • Tested on Mac OS X 10.6.4 with VMware Fusion 2.0.5 and 3.1.1.
  • A interactive user automatically logs into the system at startup. I had some issues trying to get this running without an interactive user logged in. I automatically log in for Airfoil Speakers anyway.
  • Your virtual machines live in /Virtual Machines

Create a Postgis timezone DB

Ubuntu's analog of robcowie / postgis_timezone_db.markdown

Install postgis

sudo apt-get install python-software-properties
sudo apt-add-repository ppa:ubuntugis/ppa
sudo apt-get update

sudo apt-get install postgresql-9.1-postgis

@thenewguy
thenewguy / docker_stats_with_names.sh
Created July 3, 2018 12:46 — forked from SQiShER/docker_stats_with_names.sh
Docker stats with Container Names instead of IDs
docker stats $(docker inspect -f '{{.Name}}' $(docker ps -q) | cut -c 2-)
@thenewguy
thenewguy / flower command line
Created June 28, 2018 19:32 — forked from hlawrenz/flower command line
Serve celery flower behind Django authentication.
celery flower --address=127.0.0.1 --url_prefix=flower --broker=<broker url>
@thenewguy
thenewguy / Vagrantfile
Created August 4, 2017 17:19 — forked from m0veax/Vagrantfile
Vagrant Setup for setting up suitecrm
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "box-cutter/ubuntu1604"
config.vm.network "public_network", ip: "192.168.2.253"