Skip to content

Instantly share code, notes, and snippets.

View silicontrip's full-sized avatar
💭
Less for Powershell

Mark Heath silicontrip

💭
Less for Powershell
View GitHub Profile
@silicontrip
silicontrip / sudo.m
Created December 9, 2022 06:16
sudoko solver, iterate only, no guessing.
#import <Foundation/Foundation.h>
void psetboard(NSSet * board)
{
for (int y =0; y< 9 ; y++)
{
for (int x = 0; x<9; x++)
{
if ([board containsObject:@(y*9+x)])
@silicontrip
silicontrip / mandel.m
Created May 4, 2022 00:20
Mandelbrot animator
#include <complex.h>
#include <stdio.h>
#import <Cocoa/Cocoa.h>
#import <Foundation/Foundation.h>
#import <unistd.h>
NSColor* colourWithHSV(float h, float s, float v)
{
double r, g, b;
double j;
@silicontrip
silicontrip / quicklook_mappings.json
Created March 9, 2022 22:34
Mappings for quicklook file indexer
{
"mappings": {
"properties": {
"filemeta": {
"properties": {
"_kMDItemDisplayNameWithExtensions": { "type": "text" },
"kMDItemAlternateNames": { "type": "text" },
"kMDItemBitsPerSample": { "type": "long" },
"kMDItemCFBundleIdentifier": { "type": "text", "fields": { "keyword": { "type": "keyword", "ignore_above": 256 } } },
"kMDItemColorSpace": { "type": "text", "fields": { "keyword": { "type": "keyword", "ignore_above": 256 } } },
@silicontrip
silicontrip / searchmethod.java
Created October 25, 2021 07:03
example static method to make an elasticsearch query
public static void main(String[] args)
{
RestClientBuilder cb = RestClient.builder(new HttpHost("10.35.38.214", 9200)); // configure
RestHighLevelClient client = new RestHighLevelClient(cb);
// Transport transport = new RestClientTransport(restClient, new JacksonJsonpMapper());
// ElasticsearchClient client = new ElasticsearchClient(transport);
// MultiGetRequest mgRequest = new MultiGetRequest();
// GetRequest getRequest = new GetRequest("quick_look");
@silicontrip
silicontrip / PDFStreamKeywords.txt
Created April 1, 2021 12:50
PDF commands and arguments
# ZERO Arguments
B
b
B*
b*
BI
BT
BX
EI
#!/usr/local/bin/python3
import math
import pysig as ps
lcar = ps.Square(600)
rcar = ps.Sawtooth(600)
mod = ps.Scale(ps.Sine(10),outscale=[ps.DB(-9),ps.DB(-6)])
amp = ps.DC(ps.DB(-6))
@silicontrip
silicontrip / replace-test.mm
Created February 19, 2021 09:06
QPDF test code
#include <CoreFoundation/CFString.h>
#include <qpdf/QPDF.hh>
#include <qpdf/QPDFObjectHandle.hh>
#include <qpdf/QPDFWriter.hh>
#include <Foundation/NSObjcRuntime.h>
#include <string>
int main (int argc, char* argv[])
{
@silicontrip
silicontrip / selectRectangle.jsx
Created January 18, 2021 22:45
rectangle selection photoshop
var idsetd = charIDToTypeID( "setd" );
var desc12 = new ActionDescriptor();
var idnull = charIDToTypeID( "null" );
var ref1 = new ActionReference();
var idChnl = charIDToTypeID( "Chnl" );
var idfsel = charIDToTypeID( "fsel" );
ref1.putProperty( idChnl, idfsel );
desc12.putReference( idnull, ref1 );
var idT = charIDToTypeID( "T " );
var desc13 = new ActionDescriptor();
gtvgfxrnd12:Media cadmin$ cd
gtvgfxrnd12:~ cadmin$ cd Downloads/
gtvgfxrnd12:Downloads cadmin$ cp /Volumes/Media/RESOURCES/INSTALLERS/CODEC/FlexResToolsSetup.exe .
gtvgfxrnd12:Downloads cadmin$ exit
logout
Connection to 10.35.38.214 closed.
mheath@NGTVD04669:~$ cd Documents
mheath@NGTVD04669:~/Documents$ cd Mac-VGFX/
mheath@NGTVD04669:~/Documents/Mac-VGFX$ rsync -avP cadmin@10.35.38.214:Downloads/FlexResToolSetup.exe .
receiving file list ...
public function getAccessToken($user,$pass)
{
$url = SonyCI::$host ."/oauth2/token";
# documentation say Password, but that fails password doesn't
$data = [
"client_id" => $this->config->client_id,
"client_secret" => $this->config->client_secret,
"grant_type" => "password" ];