Skip to content

Instantly share code, notes, and snippets.

View standinga's full-sized avatar

standinga

View GitHub Profile
(defn CHECKEDGES [G S unexpl BACKTRACK ORDERLIST] ;aux function checking all edges outgoing from vector S
(if (= (G S) [])
(if (= BACKTRACK [])
[G nil BACKTRACK ORDERLIST] ;nowhere to backtrack anymore new S is nil
(recur G (peek BACKTRACK) unexpl (pop BACKTRACK) (conj ORDERLIST S))) ;no more edges to verify, need to backtrack, add S to orderlist
; now if (G S) edges are not empty, check all vertices
(let [V (peek (G S))
newedges (pop (G S))
newG (assoc G S newedges)] ;new edges are without V anymore
@standinga
standinga / core.clj
Last active August 29, 2015 01:38
SC followers downloader
(ns sc.core
(:require [clj-http.client :as client]
[cheshire.core :refer :all]
[clojure.string]
[clojure.java.io :as io]))
;; !!!!!
;; FIXED version runs without problems
;; to run those functions you need enter below sound_client_id::::
package module3;
//Java utilities libraries
import java.util.ArrayList;
//import java.util.Collections;
//import java.util.Comparator;
import java.util.List;
//Processing library
import processing.core.PApplet;
@standinga
standinga / MainActivity.java
Created November 25, 2017 03:21
Get user's youtube channel id and his youtube subscribtions using Youtube com.google.api.services.youtube.YouTube, no UI.
package co.example.youtube;
/*
Example of how to get user's youtube channel id using google OAuth2,
the app needs to be registered at:
https://console.developers.google.com/apis/
Credentials->Client ID for Android
with the same package name (in this case co.example.youtube)
otherwise error 10 will be received
*/
//
// AppDelegate.swift
// RemoteReceiver
// Receive remote events from Bluetooth head set or player.
// Created by michal on 06/11/2018.
// Copyright © 2018 michal. All rights reserved.
//
import UIKit
import MediaPlayer
@standinga
standinga / main.swift
Created November 18, 2018 00:16
Read MJPEG int CGImage using Swift4, URLSession, OSX
//
// main.swift
// MJPEGreader
//
// Created by michal on 17/11/2017.
// Copyright © 2018 michal. All rights reserved.
//
import Foundation
@standinga
standinga / gist:f79232adb15e1f867ad1637f47c61003
Created January 23, 2019 01:29
multiple AVAudioPlayerNode observing lastRenderTime
//
// AudioPlayer.swift
// AudioPlayerNodes
//
// Created by michal on 23/01/2019.
// Copyright © 2019 michal. All rights reserved.
//
import AVFoundation
@standinga
standinga / AudioPlayground.swift
Last active March 22, 2023 14:06
Swift Playground shows how to play multiple wav files on top of background audio file, using AVAudioPlayerNode, AVAudioMixerNode, AVAudioEngine
import AVFoundation
import UIKit
import PlaygroundSupport
PlaygroundPage.current.needsIndefiniteExecution = true
class AudioPlayer {
var backgroundAudioFile:AVAudioFile
var topAudioFiles: [AVAudioFile] = []
@standinga
standinga / Fetching assets with PHFetchResult.swift
Last active February 13, 2019 00:15
IOS, Swift, Photos, gettin videos
import AVKit
import Photos
func getVideos() -> PHFetchResult<PHAsset> {
let fetchOptions = PHFetchOptions()
fetchOptions.sortDescriptors = [NSSortDescriptor(key: "creationDate",ascending: false)]
fetchOptions.predicate = NSPredicate(format: "mediaType = %d",PHAssetMediaType.video.rawValue)
return PHAsset.fetchAssets(with: fetchOptions)
}
@standinga
standinga / Swift Playground Audio playing audio files with AVAudioPlayerNode on top of AVPlayer or on top of another AVAudioPlayerNode.swift
Last active October 31, 2023 07:33
Swift Playground Audio playing audio files with AVAudioPlayerNode on top of AVPlayer or on top of another AVAudioPlayerNode
import AVFoundation
import PlaygroundSupport
PlaygroundPage.current.needsIndefiniteExecution = true
class AudioPlayer {
var topAudioFiles: [AVAudioFile] = []
var engine:AVAudioEngine
var backgroundAudioNode: AVAudioPlayerNode
var backgroundAudioFile: AVAudioFile