Skip to content

Instantly share code, notes, and snippets.

@edy555
edy555 / ideal.py
Created March 30, 2013 07:41
理想のSOLのtouchstoneファイルを生成するためのスクリプト
from pylab import *
import skrf as rf
f = rf.Frequency(0, 2e9, 201, 'hz')
z0 = [50.]
s = rf.Network(frequency=f, s=[-1]*f.npoints, z0=z0, name='short')
o = rf.Network(frequency=f, s=[1]*f.npoints, z0=z0, name='open')
l = rf.Network(frequency=f, s=[0]*f.npoints, z0=z0, name='load')
ns = rf.NetworkSet([s,o,l])
@edy555
edy555 / calibrate.py
Created March 30, 2013 07:43
VNA用の校正を適用するスクリプト
#!/usr/bin/env python
from pylab import *
import skrf as rf
import sys
from optparse import OptionParser
parser = OptionParser(usage="%prog: [options]")
parser.add_option("-v", "--verbose",
action="store_true", dest="verbose", default=False,
help="make lots of messages [default]")
@edy555
edy555 / plot.py
Created March 30, 2013 07:44
スミスチャート等をプロットするためのスクリプト
#!/usr/bin/env python
from pylab import *
import skrf as rf
file = sys.argv[1] or 'measured.s1p'
s = rf.Network(file)
s.plot_it_all(show_legend=False)
#subplot(122)
#ax = gca()
#s.plot_s_db(ax=ax, show_legend=False)
@edy555
edy555 / mikuplot.py
Created May 3, 2013 03:31
plotting hatsune-miku with matplotlib original source of formula from http://www.wolframalpha.com/input/?i=graph+Hatsune+miku+curve
#!/usr/bin/env python
from pylab import *
# source: http://www.wolframalpha.com/input/?i=graph+Hatsune+miku+curve
# ignore "RuntimeWarning: invalid value encountered in sqrt"
seterr(all='ignore')
# heaviside function
def theta(x):
@edy555
edy555 / miku-scope.py
Last active January 8, 2019 12:48
This script draws hatsune miku in your oscilloscope via audio output. requirement: python, numpy, pyaudio YouTube: http://youtu.be/3iCEyhPH608
#!/usr/bin/env python
from numpy import sin,sign,pi,sqrt
import numpy as np
import pyaudio
import array
# generation function derived from WolframAlpha
# http://www.wolframalpha.com/input/?i=graph+Hatsune+miku+curve
# ignore "RuntimeWarning: invalid value encountered in sqrt"
@edy555
edy555 / SerialEvent_loop.ino
Last active December 17, 2015 08:49
Work around for USB CDC based Arduino. Arduino 'Serial Event' example does not work on USB CDC based arduino such as Leonard or DaVinci board.
/*
Serial Event example
When new serial data arrives, this sketch adds it to a String.
When a newline is received, the loop prints the string and
clears it.
A good test for this is to try it with a GPS receiver
that sends out NMEA 0183 sentences.
@edy555
edy555 / collada-gencube.py
Created June 11, 2013 08:41
generate dae file with pycollada
#!/usr/bin/env python
from collada import *
import numpy
mesh = Collada()
effect = material.Effect("effect0", [], "phong", diffuse=(1,0,0), specular=(0,1,0))
mat = material.Material("material0", "mymaterial", effect)
mesh.effects.append(effect)
mesh.materials.append(mat)
@edy555
edy555 / sensortag2xively.py
Last active December 21, 2015 16:38
Fetch temperature from sensortag by bluetooth low energy and feed it up into xively. Source code is derived from https://github.com/msaunby/ble-sensor-pi usage: python sensortag2xively.py {mac address}
#!/usr/bin/env python
# Fetch temperature from sensortag by bluetooth low energy and feed it up into xively.
# Source code is derived from https://github.com/msaunby/ble-sensor-pi
# usage: python sensortag2xively.py {mac address}
import xively
import datetime
import sys
import time
import pytz
@edy555
edy555 / adf4351usb.py
Created October 2, 2013 17:46
Control script to configure Analog Devices ADF4351 via USB HID
#!/usr/bin/env python
import hid
import math
verbose = False
class ADF4351:
DIV1 = 0
DIV2 = 1
DIV4 = 2
@edy555
edy555 / openlase-apple.patch
Created October 18, 2013 11:45
patch for building openlase (https://github.com/marcan/openlase) on MacOSX
diff --git a/Modules/CMakeASM_YASMInformation.cmake b/Modules/CMakeASM_YASMInformation.cmake
index 50b2848..3d7b330 100644
--- a/Modules/CMakeASM_YASMInformation.cmake
+++ b/Modules/CMakeASM_YASMInformation.cmake
@@ -1,7 +1,13 @@
set(ASM_DIALECT "_YASM")
set(CMAKE_ASM${ASM_DIALECT}_SOURCE_FILE_EXTENSIONS asm)
-if(UNIX)
+if(APPLE)