Skip to content

Instantly share code, notes, and snippets.

View freegroup's full-sized avatar

man from earth freegroup

  • -free-
View GitHub Profile
@freegroup
freegroup / commit.js
Created February 9, 2023 19:25 — forked from lilmuckers/commit.js
A node.js script that utilises the githubber node.js GitHub API integration module to commit changes to a repository
//set up the object with the api details
function GitHubCommit(api, owner, repo, ref)
{
this.api = api;
this.repo = {
owner: owner,
repo: repo,
ref: ref
}
}
@freegroup
freegroup / k8s-list-virtualservices.go
Created May 2, 2022 14:01 — forked from dwmkerr/k8s-list-virtualservices.go
Example showing how to list Istio VirtualService CRDs Golang
// Example showing how to patch Kubernetes resources.
package main
import (
"fmt"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/client-go/dynamic"
_ "k8s.io/client-go/plugin/pkg/client/auth"
@freegroup
freegroup / github.js
Created April 14, 2022 12:06 — forked from StephanHoyer/github.js
Commiting multiple files to github over API
'use strict';
var Octokat = require('octokat');
var extend = require('lodash/object/assign');
var defaults = {
branchName: 'master',
token: '',
username: '',
reponame: ''
@freegroup
freegroup / birds-eye-view.cpp
Created September 21, 2021 08:48 — forked from anujonthemove/Birds-Eye-View Transformation.pdf
Bird's eye view perspective transformation using OpenCV
// OpenCV imports
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
// C++ imports
#include <iostream>
// namespaces
using namespace std;
using namespace cv;
var RED_INTENCITY_COEF = 0.2126;
var GREEN_INTENCITY_COEF = 0.7152;
var BLUE_INTENCITY_COEF = 0.0722;
//var canvas = document.createElement('CANVAS');
var canvas = document.getElementById('viewport');
var ctx = canvas.getContext('2d');
var img = new Image;
@freegroup
freegroup / otsu.js
Created June 5, 2020 22:46 — forked from zz85/otsu.js
Otsu's method - Automatic Histogram Based Image Thresholding
// Read https://en.wikipedia.org/wiki/Otsu%27s_method (added this since JS examples in wikipedia didn't work)
function otsu(histData /* Array of 256 greyscale values */, total /* Total number of pixels */) {
let sum = 0;
for (let t=0 ; t<256 ; t++) sum += t * histData[t];
let sumB = 0;
let wB = 0;
let wF = 0;
#!/usr/bin/env python
##############################################
# The MIT License (MIT)
# Copyright (c) 2016 Kevin Walchko
# see LICENSE for full details
##############################################
from pyservos import Packet
from pyservos.servoserial import ServoSerial
import pyservos
# Stel de GPIO pinnen in voor de stappenmotor:
import sys
import time
import RPi.GPIO as GPIO
# Use BCM GPIO references
# instead of physical pin numbers
GPIO.setmode(GPIO.BCM)
StepPins = [23,24,25,4]
import RPi.GPIO as GPIO
import time
import os
shutdownPin = 14
GPIO.setmode(GPIO.BCM)
GPIO.setup(shutdownPin,GPIO.IN, pull_up_down=GPIO.PUD_UP)
while True:
pinStatus = GPIO.input(shutdownPin)
# Stel de GPIO pinnen in voor de stappenmotor:
import sys
import time
import RPi.GPIO as GPIO
# Use BCM GPIO references
# instead of physical pin numbers
GPIO.setmode(GPIO.BCM)