Skip to content

Instantly share code, notes, and snippets.

View balopat's full-sized avatar
🎯
Focusing

Balint Pato balopat

🎯
Focusing
View GitHub Profile
@balopat
balopat / gist:957474b6d0cf9a9f3e40a9c182d4f5df
Created April 4, 2022 12:33
Shor(4) state invariant Z-signings
(1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
(1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0)
(0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0)
(1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0)
(1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0)
(0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0)
(1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0)
(1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0)
(0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0)
(0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0)
CommutativityPlot[group_, OptionsPattern[]] :=
Module[{els, n, CycleLengths, ConjClasses, conjClasses, ConjClass,
ConjClassId, colorList, conjugacyClassColor, regularGridColor,
notCommutingColor, commutingColor, indexed, ConjClassSeparator,
tickers, markers, mx},
els = GroupElements[group];
n = Length[els];
(* Initial sorting of elements provides a good approximation for \
@balopat
balopat / generate_compatibility_table.py
Created June 10, 2021 01:45
Generate compatibility matrix for cirq-google protobuf / grpcio-tools
import dataclasses
import subprocess
import sys
import traceback
from collections import defaultdict
from typing import Dict, Optional
 
grcpio_tools_versions = ["1.26.0","1.27.1","1.28.1","1.30.0","1.31.0","1.32.0","1.33.2","1.34.0","1.35.0","1.36.0","1.37.0","1.38.0"]
protobuf_versions = ["3.8.0", "3.9.2", "3.10.0", "3.11.3", "3.12.4", "3.13.0", "3.14.0", "3.15.8", "3.16.0", "3.17.3"]
 
@balopat
balopat / gist:59d7664513d0ed106dbe4a840db6d11f
Created July 1, 2016 10:53
mix-ide built from source (1.2.9 umbrella version) startup log after verify_app error
/Users/balopat/Library/Caches/Homebrew/webthree-umbrella/build/mix/./Mix-ide.app/Contents/MacOS/Mix-ide
objc[61555]: Class RunLoopModeTracker is implemented in both /usr/local/Cellar/qt5/5.6.1-1/lib/QtCore.framework/Versions/5/QtCore and /Users/balopat/Library/Caches/Homebrew/webthree-umbrella/build/mix/Mix-ide.app/Contents/Frameworks/QtCore.framework/Versions/5/QtCore. One of the two will be used. Which one is undefined.
objc[61555]: Class NotificationReceiver is implemented in both /usr/local/Cellar/qt5/5.6.1-1/lib/QtWidgets.framework/Versions/5/QtWidgets and /Users/balopat/Library/Caches/Homebrew/webthree-umbrella/build/mix/Mix-ide.app/Contents/Frameworks/QtWidgets.framework/Versions/5/QtWidgets. One of the two will be used. Which one is undefined.
objc[61555]: Class AVCaptureDeviceGlue is implemented in both /usr/local/Cellar/qt5/5.6.1-1/lib/QtWebEngineCore.framework/Versions/5/QtWebEngineCore and /Users/balopat/Library/Caches/Homebrew/webthree-umbrella/build/mix/Mix-ide.app/Contents/Frameworks/QtWebEngi
@balopat
balopat / gist:f8a10783ff1b42410118c56c7abd3f75
Created July 1, 2016 10:49
1.0.5 mix-ide crash after trying to open new project
Process: Mix-ide [60677]
Path: /Applications/Mix-ide.app/Contents/MacOS/Mix-ide
Identifier: .
Version: ??? (mix )
Code Type: X86-64 (Native)
Parent Process: ??? [1]
Responsible: Mix-ide [60677]
User ID: 501
Date/Time: 2016-07-01 06:40:16.637 -0400
object sb {
import java.net._
import java.util._
import scala.sys.process.Process
import scala.io._
// constantsp
private val recorderUrl = "http://recorder.samebug.io"
private val uiUrl = "http://beta.samebug.io"
private val notifierUrl = new URL("https://oss.sonatype.org/service/local/repositories/snapshots/content/com/samebug/notifier/samebug-notifier/2.0.0-SNAPSHOT/samebug-notifier-2.0.0-20140620.093402-6.jar")
package com.balopat.timeinjection
import org.scalatest.FlatSpec
import java.util.Date
import org.scalatest.matchers.ShouldMatchers
class RealClockSpec extends FlatSpec with ShouldMatchers {
"RealClock " should "give back instant between the command before and after" in {
val clock: RealClock = new RealClock()
package com.balopat.timeinjection
import org.scalatest.FlatSpec
import java.util.Date
import org.scalatest.matchers.ShouldMatchers
class WallSpec extends FlatSpec with ShouldMatchers {
class MockedClock(var time: Date) extends Clock {
def getTime() = time
package com.balopat.timeinjection
import java.util.Date
class RealClock extends Clock {
def getTime() = new Date()
}
trait Clock {
def getTime(): Date
@balopat
balopat / Wall.scala
Last active December 26, 2015 22:59
Hardcoded dependency on time
package com.balopat.timeinjection
import java.util.Date
class Wall {
var messages = List[Message]()
def message(message: String) {
messages ::= Message(message, new Date()) // hardcoded dependency on time!!!
}