Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@programmarchy
programmarchy / gist:c9d02e22d58bfab3f8bb
Created March 25, 2015 15:45
BluetoothLowEnergy.cpp
// BluetoothLowEnergy.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#pragma warning (disable: 4068)
#include <windows.h>
#include <stdio.h>
#include <tchar.h>
@programmarchy
programmarchy / gist:d2ce0270a89bcd102220748a58d0303e
Last active January 13, 2024 02:06
Quixel Bridge MSPlugin modified for Blender 3.0
# ##### QUIXEL AB - MEGASCANS PLugin FOR BLENDER #####
#
# The Megascans Plugin plugin for Blender is an add-on that lets
# you instantly import assets with their shader setup with one click only.
#
# Because it relies on some of the latest 2.80 features, this plugin is currently
# only available for Blender 2.80 and forward.
#
# You are free to modify, add features or tweak this add-on as you see fit, and
# don't hesitate to send us some feedback if you've done something cool with it.
@programmarchy
programmarchy / dns-dhcp.bat
Created August 24, 2011 14:52
Batch files for switching DNS servers between Google (8.8.8.8, 8.8.4.4) and DHCP
REM
REM Usage:
REM dns-dhcp.bat
REM
REM Description:
REM Configures DNS Servers with DHCP on interfaces listed below.
REM
REM To change interfaces, replace "name" with your interface names, or use "index" instead.
REM
REM To list the names and indices of your interfaces, run:
@programmarchy
programmarchy / generate_blender_materials.py
Last active January 28, 2022 21:40
Blender script which, given an active object, copies the material for that object assigning new PBR texture maps from a local directory structure
import bpy
active_object = bpy.context.active_object
col_width = 10
if active_object is None:
raise Exception("Select an object to use as a template")
for i in range(1, 100):
n = i + 1
@programmarchy
programmarchy / install.sh
Created April 14, 2021 03:53
Modified install script to locally install Deno version manager (dvm)
#!/bin/sh
# Copyright 2019 the Deno authors. All rights reserved. MIT license.
# Copyright 2020 justjavac. All rights reserved. MIT license.
# TODO(everyone): Keep this script simple and easily auditable.
set -e
# if [ "$(uname -m)" != "x86_64" ]; then
# echo "Error: Unsupported architecture $(uname -m). Only x64 binaries are available." 1>&2
# exit 1
#include <FastLED.h>
#define LED_PIN 7
#define NUM_LEDS 240
CRGB leds[NUM_LEDS];
int offset = 0;
void setup() {
FastLED.addLeds<WS2812, LED_PIN, GRB>(leds, NUM_LEDS);
@programmarchy
programmarchy / build-app-icon.sh
Last active May 12, 2020 10:11
Given a high resolution icon image, use imagemagick to scale down to all iOS app icon dimensions
APP_NAME="YOUR_APP_NAME_HERE"
SRC=./Design/AppIcon.png
DST=./$APP_NAME/Assets.xcassets/AppIcon.appiconset
convert $SRC -resize 1024x1024 "$DST/AppIcon1024x1024.png"
convert $SRC -resize 2048x2048 "$DST/AppIcon2048x2048.png"
convert $SRC -resize 29x29 "$DST/AppIcon29x29.png"
convert $SRC -resize 58x58 "$DST/AppIcon29x29@2x.png"
convert $SRC -resize 87x87 "$DST/AppIcon29x29@3x.png"
convert $SRC -resize 80x80 "$DST/AppIcon40x40@2x.png"
@programmarchy
programmarchy / BusyController.swift
Created November 15, 2018 06:50
A simple drop in controller for making a UIView look busy
import UIKit
class BusyController<V: UIView> {
let view: V
var busyView: UIView? = nil
var busyText: String = "Loading...".localized()
init(view: V) {
@programmarchy
programmarchy / Fastfile
Created September 14, 2018 20:21
A Fastlane action that publishes a Pact contract to a Pact broker. See https://pact.io for more details.
# Example Fastfile using the `publish_pact_to_broker` action.
#
# NOTE: Since Fastlane uses dotenv, create a `.env` file in the fastlane
# directory to set `PACT_BROKER_USERNAME` and `PACT_BROKER_PASSWORD` and
# keep it secret by adding it to .gitignore.
default_platform(:ios)
xcodeproj = "MyProject.xcodeproj"
slack_url = "https://hooks.slack.com/services/MY/SLACK/WEBHOOK"
@programmarchy
programmarchy / TemplateImageButton.swift
Created April 27, 2017 22:59
View templated images in Interface Builder
import UIKit
@IBDesignable
class TemplateImageButton: UIButton {
#if TARGET_INTERFACE_BUILDER
let templateImageView = UIImageView()
override init(frame: CGRect) {