This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
class Display: | |
def __init__(self, dist, width, resolution): | |
self.distance = dist | |
self.width = width | |
self.resolution = resolution | |
# Credit to gmb zre 11/1/07, ported to python by Viet Ta |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
# RUN: | |
# python main.py fd_min=100 fd_max=250 sd_min=20 sd_max=50 vel_min=30 vel_max=100 sam_freq=50 X=1024 Y=768 dist=60 size=53.34 | |
def main(): | |
kwargs_raw = sys.argv[1:] | |
kwargs = {key: val for key, val in (a.split('=', 1) for a in kwargs_raw)} | |
print(kwargs) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
import string | |
def generator(size=6, chars=string.ascii_uppercase + string.digits): | |
return ''.join(random.choice(chars) for _ in range(size)) | |
def ran(): | |
return random.randint(0, 3800) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import math | |
def test(iteration): | |
radius = np.random.randint(0, 1000) | |
sum_area = 0 | |
for i in range(iteration): | |
x = np.random.uniform(-radius, radius) | |
y = math.sqrt(radius * radius - x * x) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
''' | |
This's a just a stupid example with the sole purpose of | |
demonstrating the Monte Carlo randomization strategy | |
''' | |
A = np.random.randint(0, 10000, 1000) | |
for x in range(1000000): | |
first_position = np.random.randint(0, 1000) | |
second_position = np.random.randint(0, 1000) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('#container').highcharts({ | |
chart: { | |
alignTicks: true, // When using multiple axis, the ticks of two or more opposite axes will automatically be aligned by adding ticks to the axis or axes with the least ticks. | |
animation: true, // Set the overall animation for all chart updating. Animation can be disabled throughout the chart by setting it to false here. | |
backgroundColor: '#FFF', // The background color or gradient for the outer chart area. | |
borderColor: '#4572A7', // The color of the outer chart border. | |
borderRadius: 5, // The corner radius of the outer chart border. In export, the radius defaults to 0. Defaults to 5. | |
borderWidth: 0, // The pixel width of the outer chart border. | |
className: null, // A CSS class name to apply to the charts container div, allowing unique CSS styling for each chart. | |
defaultSeriesType: 'line', // Alias of type. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
div(ng-class="{'class1': $index === 1, | |
'class2': $index === 2, | |
'class3': $index !== 1 && $index !== 2}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function () { | |
angular | |
.module('shared.factories') | |
.factory('_', LodashFactory); | |
LodashFactory.$inject = ['$window', '$state']; | |
function LodashFactory($window, $state) { | |
if(!$window._){ | |
var lodashCdnUrl = 'https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.4/lodash.min.js'; | |
loadScript(lodashCdnUrl, function () { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function AlterQueryString(param, val) { | |
var queryString = window.location.search.replace("?", ""); | |
var parameterListRaw = queryString == "" ? [] : queryString.split("&"); | |
var parameterList = {}; | |
for (var i = 0; i < parameterListRaw.length; i++) { | |
var parameter = parameterListRaw[i].split("="); | |
if (typeof val != 'undefined') { | |
parameterList[parameter[0]] = parameter[1]; | |
} else if (param != parameter[0]) { | |
parameterList[parameter[0]] = parameter[1]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; Shift + Wheel for horizontal scrolling | |
+WheelUp:: | |
; Scroll to the left | |
MouseGetPos,,,id, fcontrol,1 | |
Loop 8 ; <-- Increase for faster scrolling | |
SendMessage, 0x114, 0, 0, %fcontrol%, ahk_id %id% ; 0x114 is WM_HSCROLL and the 0 after it is SB_LINERIGHT. | |
return | |
+WheelDown:: | |
;Scroll to the right | |
MouseGetPos,,,id, fcontrol,1 |