text
stringlengths
1
1.05M
def prime_sum(n): prime_list = [] for i in range(2, n + 1): if all(i % j != 0 for j in range(2, int(i ** 0.5) + 1)): prime_list.append(i) return sum(prime_list)
#!/bin/bash # Script to deploy a very simple web application. # The web app has a customizable image and some text. cat << EOM > /var/www/html/index.html <html> <head><title>Meow!</title></head> <body> <div style="width:800px;margin: 0 auto"> <!-- BEGIN --> <center><img src="http://${PLACEHOLDER}/${WIDTH}/${HEIGHT}"></img></center> <center><h2>Meow World!</h2></center> Welcome to ${PREFIX}'s Cat-terific, Meow-merizing Page. Marketing 101 say's "insert cattttttchy phrase here" <!-- END --> </div> </body> </html> EOM echo "Script complete."
<reponame>paloverde-grupo/jakkerp <?php include_once(dirname(dirname(__FILE__)).DIRECTORY_SEPARATOR."lang".DIRECTORY_SEPARATOR."en.php"); include_once(dirname(dirname(__FILE__)).DIRECTORY_SEPARATOR."config.php"); if(file_exists(dirname(dirname(__FILE__)).DIRECTORY_SEPARATOR."lang".DIRECTORY_SEPARATOR.$lang.".php")){ include_once(dirname(dirname(__FILE__)).DIRECTORY_SEPARATOR."lang".DIRECTORY_SEPARATOR.$lang.".php"); } foreach($mobilewebapp_language as $i => $l){ $mobilewebapp_language[$i] = str_replace("'", "\'", $l); } ?> var chatMessageCount = 0; var initializeMobileWebapp = 1; (function($){ $.chatmobilewebapp = (function(){ var currentChatboxId = 0; var onlineScroll; var hideWebBar; var keyboardOpen = 0; var landscapeMode = 0; var buddyListName = {}; var buddyListAvatar = {}; var buddyListMessages = {}; var detectTimer; var enableType = '<?php echo $enableType ?>'; var clearmsg = {}; return { playSound: function(){ document.getElementsByTagName('audio')[0].play(); }, chatdetect: function(keyboard){ clearTimeout(detectTimer); detectTimer = setTimeout(function(){ jqcc.mobilewebapp.detect(); }, 200); }, chatinit: function(){ jqcc.mobilewebapp.detect(); window.addEventListener('onorientationchange' in window ? 'orientationchange' : 'resize', function(){ jqcc.mobilewebapp.detect(); }, false); if(typeof (jqcc.cookie(cookie_prefix+'new'))!='undefined'&&jqcc.cookie(cookie_prefix+'new')!=''){ jqcc.chatmobilewebapp.loadPanel(jqcc.cookie(cookie_prefix+'new')); jqcc.cookie(cookie_prefix+'new', '', {path: '/'}); } if (location.href.match('extensions/mobilewebapp/#user-')) { $userid = location.href.split('extensions/mobilewebapp/#user-'); window.history.pushState('', '', jqcc.cometchat.getBaseUrl()+'extensions/mobilewebapp/'); jqcc.chatmobilewebapp.chatWith($userid[1]); } }, chatbuddyList: function(data){ var buddylist = ''; var buddylisttemp = {}; buddylisttemp['available'] = ''; buddylisttemp['busy'] = ''; buddylisttemp['offline'] = ''; buddylisttemp['away'] = ''; var thumbnaillimit = <?php echo intval($thumbnailDisplayNumber);?>; var buddylistsize = data.length; var displaythumbnail = true; if(buddylistsize > thumbnaillimit){ displaythumbnail = false; } $.each(data, function(i, buddy){ longname = buddy.n; buddyListName[buddy.id] = buddy.n; buddyListAvatar[buddy.id] = buddy.a; if(!buddyListMessages[buddy.id]){ buddyListMessages[buddy.id] = 0; } var imgTag = displaythumbnail?'<img src="'+buddy.a+'" class=" avatarimage"/>':''; buddylisttemp[buddy.s] += '<li id="onlinelist_'+buddy.id+'" class="row userlists" onclick="javascript:jqcc.chatmobilewebapp.loadPanel(\''+buddy.id+'\')" data-filtertext="'+longname+'"><div class="small-7 columns"><img src="images/cleardot.gif" class=" status status-'+buddy.s+' "><span class="longname search_name">'+longname+'</span></div><div class="small-5 columns">'+imgTag+'<span class="newmessages">'+buddyListMessages[buddy.id]+'</span></div></li>'; $('#onlinelist_'+buddy.id).remove(); }); buddylist = buddylisttemp['available']+buddylisttemp['busy']+buddylisttemp['away']+buddylisttemp['offline']; if(buddylist==''){ buddylist += '<li class="onlinelist" id="nousersonline">'+jqcc.cometchat.getLanguage(14)+'</li>'; $('#wolist').html(buddylist); } else{ $('#wolist').html(buddylist); $('#wolist').append('<li class="onlinelist row" id="wolast" style="background:none !important;"></li>'); } if(initializeMobileWebapp){ if(typeof (jqcc.mobilewebapp.ccstateReader)=='function'){ jqcc.mobilewebapp.ccstateReader(); } initializeMobileWebapp = 0; } }, clearChatbox: function(id){ $('#cometchat_container_report').find('.cometchat_closebox').click(); $('#opt').css('display', 'none'); var myid = jqcc.cometchat.getThemeVariable('userid'); var chatboxId = id; var lastMsg = $("#cwlist").find("li:last div").attr('id'); var msgId = parseInt(lastMsg.split('_')[2]); clearmsg[chatboxId] = msgId; $.ccclearconversation.init(chatboxId); $("#cwlist").empty(); setTimeout(function(){ jqcc.mobilewebapp.scrollToBottom(); }, 700); }, reportChat: function(id){ $('#cometchat_container_report').find('.cometchat_closebox').click(); $('#opt').css('display', 'none'); var chatboxId = id; if($('#cwlist').find('li').length){ var callbackfn = 'mobilewebapp'; $.ccreport.init(chatboxId, callbackfn); }else{ alert('<?php echo $mobilewebapp_language[32];?>'); } setTimeout(function(){ jqcc.mobilewebapp.scrollToBottom(); }, 700); }, chatWith: function(id, chatroomId){ if(typeof (jqcc.chatmobilewebapp)!=='undefined'){ if(jqcc.mobilewebapp.chatwith()){ jqcc.chatmobilewebapp.loadPanel(id); } } if(chatroomId){ jqcc.cometchat.leaveChatroom(chatroomId, 0, 'mobilewebapp'); } }, chatboxKeydownSet: function(id){ var message = jqcc.mobilewebapp.checkSmiley($('#chatmessage').val()); if($.trim(message)!=""){ jqcc.cometchat.chatboxKeydownSet(id, message); } $('#chatmessage').val(''); $('#chatmessage').focus(); return false; }, attachMessage: function(data){ var temp = ''; var atleastOneNewMessage = 0; $.each(data, function(i, incoming){ if(!buddyListName[incoming.from]){ jqcc.cometchat.getUserDetails(incoming.from); } fromname = buddyListName[incoming.from]; if(fromname.indexOf(" ")!=-1){ fromname = fromname.slice(0, fromname.indexOf(" ")); } var message = incoming.message; if((message!=''&&(message.indexOf('jqcc.cc')>-1))){ var first = message.indexOf('<a'); message = message.substring(0, (first-1)); incoming.message = message+'<?php echo $mobilewebapp_language[34];?>'; }else if(((message.indexOf('jqcc.cometchat.joinChatroom')>-1))){ incoming.message = '<?php echo $mobilewebapp_language[35];?>'; } if(incoming.self==0){ var temp = (('<li><div class="cometchat_chatboxmessage you" id="cometchat_message_'+incoming.id+'"><span class="cometchat_chatboxmessagecontent">'+incoming.message+'</span>'+'</div><div style="clear:both;"></div></li>')); atleastOneNewMessage++; if(currentChatboxId==incoming.from){ if(!(clearmsg[incoming.from])||(clearmsg[incoming.from]<incoming.id&&currentChatboxId==incoming.from)){ $('#cwlist').append(temp); setTimeout(function(){ jqcc.mobilewebapp.scrollToBottom(); }, 500); } }else{ if(buddyListMessages[incoming.from]){ if(incoming.old!=1) buddyListMessages[incoming.from] += 1; }else{ if(incoming.old!=1) buddyListMessages[incoming.from] = 1; } if(buddyListMessages[incoming.from]>0){ $('#onlinelist_'+incoming.from+' .newmessages').html(buddyListMessages[incoming.from]).addClass('newmessageCount'); jqcc.chatmobilewebapp.notification(); } } }else if(incoming.self==1){ if($("#cometchat_message_"+incoming.id).length>0){ if(!$("#cometchat_message_"+incoming.id).find("a").hasClass('imagemessage')){ $("#cometchat_message_"+incoming.id).find("span.cometchat_chatboxmessagecontent").html(incoming.message); } }else{ if($("#cwlist #cometchat_message_"+incoming.id).length!=1){ fromname = '<?php echo $mobilewebapp_language[6];?>'; selfstyle = 'selfmessage'; var temp = (('<li><div class="cometchat_chatboxmessage '+selfstyle+' me" id="cometchat_message_'+incoming.id+'"><span class="cometchat_chatboxmessagecontent">'+incoming.message+'</span>'+'</div><div style="clear:both;"></div></li>')); if(currentChatboxId==incoming.from){ if(!(clearmsg[incoming.from])||(clearmsg[incoming.from]<incoming.id&&currentChatboxId==incoming.from)){ $('#cwlist').append(temp); setTimeout(function(){ jqcc.mobilewebapp.scrollToBottom(); }, 500); } } } } } if(incoming.old==0){ jqcc.chatmobilewebapp.playSound(); } }); }, chatloadUserData: function(id, data){ buddyListName[id] = data.n; buddyListAvatar[id] = data.a; if(!buddyListMessages[id]){ buddyListMessages[id] = 0; } longname = data.n; var buddylist = '<li id="onlinelist_'+data.id+'" onclick="javascript:jqcc.chatmobilewebapp.loadPanel(\''+data.id+'\')" data-filtertext="'+longname+'"><img src="images/cleardot.gif" class="status status-'+data.s+' "><span class="longname">'+longname+'</span><span class=""><img src="'+buddy.a+'" class=" avatarimage"/></span><span class="newmessages">0</span></li>'; $('#nousersonline').css('display', 'none'); $('#permanent').prepend(buddylist); }, joinChatroom: function(roomid, inviteid, roomname){ javascript:jqcc.mobilewebapp.mobilechatroom(roomid, roomname, 1, inviteid, 1); jqcc.mobilewebapp.loadChatroom(); }, loadPanel: function(id, name){ if(typeof (id)!='undefined'&&id!=null){ buddyListMessages[id] = 0; $('#onlinelist_'+id).find('span.newmessages').html('0').removeClass('newmessageCount'); var cc_state = jqcc.cookie(cookie_prefix+'state'); if(typeof (cc_state)!='undefined'&&cc_state!=null&&cc_state!=''){ var pattern = id+"\\|[0-9]+"; var regex = new RegExp(pattern); cc_state = cc_state.replace(regex, id+"|0"); jqcc.cookie(cookie_prefix+'state', cc_state, {path: '/'}); } var userName = buddyListName[id]; var flag = 0; if(userName===undefined){ if(!isNaN(id)){ jqcc.cometchat.getUserDetails(id); userName = jqcc.cometchat.getName(id); flag = 1; } }else{ flag = 1; } var refreshIntervalId = setInterval(function(){ if(flag==1){ clearInterval(refreshIntervalId); $('#chatheader').find("h1").html(userName); $('#scroller').html('<ul id="cwlist"></ul>'); $("#chatmessage").keyup(function(event){ if($("#chatmessage").val()!==''&&event.keyCode==13&&event.shiftKey==0) $("#chat_send").click() }); $('#chat_send').attr('onclick', 'return jqcc.chatmobilewebapp.chatboxKeydownSet(\''+id+'\')'); $('#clear').attr('onclick', 'return jqcc.chatmobilewebapp.clearChatbox(\''+id+'\')'); $('#report').attr('onclick', 'return jqcc.chatmobilewebapp.reportChat(\''+id+'\')'); jqcc.mobilewebapp.loadChatbox(); } }, 100); jqcc.mobilewebapp.detect(); currentChatboxId = id; $('#chatmessage').blur(function(){ keyboardOpen = 0; jqcc.mobilewebapp.detect(); }); jqcc.cometchat.getRecentData(id); setTimeout(function(){ jqcc.mobilewebapp.scrollToBottom(); }, 500); document.cookie = '<?php echo $cookiePrefix;?>chat='+urlencode(id+':'+urlencode(userName)); } }, chatloadData: function(id, data){ $.each(data, function(type, item){ if(type=='messages'){ var temp = ''; $.each(item, function(i, incoming){ var message = incoming.message; if(((message.indexOf('jqcc.cc')>-1))){ var first = message.indexOf('<a'); message = message.substring(0, (first-1)); incoming.message = message+'<?php echo $mobilewebapp_language[34];?>'; }else if(((message.indexOf('jqcc.cometchat.joinChatroom')>-1))){ incoming.message = '<?php echo $mobilewebapp_language[35];?>'; } var self; var selfstyle = ''; var messagefrom = ''; if(incoming.self==1){ fromname = '<?php echo $mobilewebapp_language[6];?>'; selfstyle = 'selfmessage'; }else{ fromname = buddyListName[id]; } var ts = new Date(incoming.sent*1000); if(fromname.indexOf(" ")!=-1){ fromname = fromname.slice(0, fromname.indexOf(" ")); } if(selfstyle==''){ self = 'you'; }else{ self = 'me'; } temp += ('<li><div class="cometchat_chatboxmessage '+selfstyle+' '+self+'" id="cometchat_message_'+incoming.id+'">'+messagefrom+'<span class="cometchat_chatboxmessagecontent'+selfstyle+'">'+incoming.message+'</span>'+'</div><div style="clear:both;"></div>'); }); if(currentChatboxId==id){ setTimeout(function(){ $('#cwlist').append(temp); setTimeout(function(){ jqcc.mobilewebapp.scrollToBottom(); }, 500); }, 200) } } }); }, getChatCookie: function(){ var cookieName = '<?php echo $cookiePrefix;?>'+'chat'; var cookieData = jqcc.mobilewebapp.getCookieInfo(cookieName); if(typeof (cookieData)!='undefined'&&cookieData!=""){ var cDetails = urldecode(cookieData).split(":") var id = cDetails[0]; setTimeout(function(){ jqcc.chatmobilewebapp.loadPanel(id); }, 500); }else{ jqcc.mobilewebapp.loadChatboxReverse(); } }, back: function(){ document.cookie = '<?php echo $cookiePrefix;?>chat='; currentChatboxId = 0; }, notification: function(){ chatMessageCount = 0; $.each(buddyListMessages, function(i, j){ chatMessageCount = chatMessageCount+j; }); if($("#lobby").is(':visible')){ $('span.notifier').html(chatMessageCount); } } }; })(); })(jqcc); var listener = function(e){ e.preventDefault(); }; window.onload = function(){ if(typeof (jqcc.mobilewebapp.getChatroomCookie)=='function'){ jqcc.mobilewebapp.getChatroomCookie(); } jqcc.chatmobilewebapp.getChatCookie(); document.cookie = '<?php echo $cookiePrefix;?>chat='; document.cookie = '<?php echo $cookiePrefix;?>chatroom='; jqcc.mobilewebapp.init(); } if($("#buddy").is(':visible')){ jqcc.chatmobilewebapp.notification(); }
def compute_aggregate_metric_ops(metric_ops, module_names, model_params): metrics = [] ops = [] if 'boundary' in module_names and model_params.get('boundary_weight', 0) > 0: metrics.append(metric_ops.get('boundary/f1', None)) return metrics, ops
function generateRandomString(length, chars) { let result = ''; for (let i = 0; i < length; i++) { result += chars[randInt(0, chars.length - 1)]; } return result; }
<reponame>xranby/direct_bt<filename>java/org/tinyb/BluetoothManager.java<gh_stars>1-10 /** * Author: <NAME> <<EMAIL>> * Copyright (c) 2020 Gothel Software e.K. * Copyright (c) 2020 ZAFENA AB * * Author: <NAME> <<EMAIL>> * Copyright (c) 2016 Intel Corporation. * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package org.tinyb; import java.util.List; public interface BluetoothManager { /** Find a BluetoothObject of a type matching type. If parameters name, * identifier and parent are not null, the returned object will have to * match them. * It will first check for existing objects. It will not turn on discovery * or connect to devices. * @parameter type specify the type of the object you are * waiting for, NONE means anything. * @parameter name optionally specify the name of the object you are * waiting for (for Adapter or Device) * @parameter identifier optionally specify the identifier of the object you are * waiting for (UUID for GattService, GattCharacteristic or GattDescriptor, address * for Adapter or Device) * @parameter parent optionally specify the parent of the object you are * waiting for * @parameter timeoutMS the function will return after timeout time in milliseconds, a * value of zero means wait forever. If object is not found during this time null will be returned. * @return An object matching the name, identifier, parent or null if not found before * timeout expires or event is canceled. */ public BluetoothObject find(BluetoothType type, String name, String identifier, BluetoothObject parent, long timeoutMS); /** Find a BluetoothObject of a type matching type. If parameters name, * identifier and parent are not null, the returned object will have to * match them. * It will first check for existing objects. It will not turn on discovery * or connect to devices. * @parameter type specify the type of the object you are * waiting for, NONE means anything. * @parameter name optionally specify the name of the object you are * waiting for (for Adapter or Device) * @parameter identifier optionally specify the identifier of the object you are * waiting for (UUID for GattService, GattCharacteristic or GattDescriptor, address * for Adapter or Device) * @parameter parent optionally specify the parent of the object you are * waiting for * @return An object matching the name, identifier and parent. */ public BluetoothObject find(BluetoothType type, String name, String identifier, BluetoothObject parent); /** Find a BluetoothObject of type T. If parameters name, identifier and * parent are not null, the returned object will have to match them. * It will first check for existing objects. It will not turn on discovery * or connect to devices. * @parameter name optionally specify the name of the object you are * waiting for (for Adapter or Device) * @parameter identifier optionally specify the identifier of the object you are * waiting for (UUID for GattService, GattCharacteristic or GattDescriptor, address * for Adapter or Device) * @parameter parent optionally specify the parent of the object you are * waiting for * @parameter timeoutMS the function will return after timeout time in milliseconds, a * value of zero means wait forever. If object is not found during this time null will be returned. * @return An object matching the name, identifier, parent or null if not found before * timeout expires or event is canceled. */ public <T extends BluetoothObject> T find(String name, String identifier, BluetoothObject parent, long timeoutMS); /** Find a BluetoothObject of type T. If parameters name, identifier and * parent are not null, the returned object will have to match them. * It will first check for existing objects. It will not turn on discovery * or connect to devices. * @parameter name optionally specify the name of the object you are * waiting for (for Adapter or Device) * @parameter identifier optionally specify the identifier of the object you are * waiting for (UUID for GattService, GattCharacteristic or GattDescriptor, address * for Adapter or Device) * @parameter parent optionally specify the parent of the object you are * waiting for * @return An object matching the name, identifier and parent. */ public <T extends BluetoothObject> T find(String name, String identifier, BluetoothObject parent); /** Return a BluetoothObject of a type matching type. If parameters name, * identifier and parent are not null, the returned object will have to * match them. Only objects which are already in the system will be returned. * @parameter type specify the type of the object you are * waiting for, NONE means anything. * @parameter name optionally specify the name of the object you are * waiting for (for Adapter or Device) * @parameter identifier optionally specify the identifier of the object you are * waiting for (UUID for GattService, GattCharacteristic or GattDescriptor, address * for Adapter or Device) * @parameter parent optionally specify the parent of the object you are * waiting for * @return An object matching the name, identifier, parent or null if not found. */ public BluetoothObject getObject(BluetoothType type, String name, String identifier, BluetoothObject parent); /** Return a List of BluetoothObject of a type matching type. If parameters name, * identifier and parent are not null, the returned object will have to * match them. Only objects which are already in the system will be returned. * @parameter type specify the type of the object you are * waiting for, NONE means anything. * @parameter name optionally specify the name of the object you are * waiting for (for Adapter or Device) * @parameter identifier optionally specify the identifier of the object you are * waiting for (UUID for GattService, GattCharacteristic or GattDescriptor, address * for Adapter or Device) * @parameter parent optionally specify the parent of the object you are * waiting for * @return A vector of object matching the name, identifier, parent. */ public List<BluetoothObject> getObjects(BluetoothType type, String name, String identifier, BluetoothObject parent); /** Returns a list of BluetoothAdapters available in the system * @return A list of BluetoothAdapters available in the system */ public List<BluetoothAdapter> getAdapters(); /** Returns a list of discovered BluetoothDevices * @return A list of discovered BluetoothDevices */ public List<BluetoothDevice> getDevices(); /** Returns a list of available BluetoothGattServices * @return A list of available BluetoothGattServices */ public List<BluetoothGattService> getServices(); /** Sets a default adapter to use for discovery. * @return TRUE if the device was set */ public boolean setDefaultAdapter(BluetoothAdapter adapter); /** Gets the default adapter to use for discovery. * <p> * System default is the last detected adapter at initialisation. * </p> * @return the used default adapter */ public BluetoothAdapter getDefaultAdapter(); /** Turns on device discovery on the default adapter if it is disabled. * @return TRUE if discovery was successfully enabled * @deprecated since 2.0.0, use {@link #startDiscovery(boolean)}. */ @Deprecated public boolean startDiscovery() throws BluetoothException; /** * Turns on device discovery on the default adapter if it is disabled. * @param keepAlive if {@code true}, indicates that discovery shall be restarted * if stopped by the underlying Bluetooth implementation (BlueZ, ..). * Using {@link #startDiscovery(boolean) startDiscovery}({@code keepAlive=true}) * and {@link #stopDiscovery()} is the recommended workflow * for a reliable discovery process. * @return TRUE if discovery was successfully enabled * @throws BluetoothException * @since 2.0.0 * @implNote {@code keepAlive} not implemented in tinyb.dbus */ public boolean startDiscovery(final boolean keepAlive) throws BluetoothException; /** Turns off device discovery on the default adapter if it is enabled. * @return TRUE if discovery was successfully disabled */ public boolean stopDiscovery() throws BluetoothException; /** Returns if the discovers is running or not. * @return TRUE if discovery is running */ public boolean getDiscovering() throws BluetoothException; /** * Release the native memory associated with this object and all related Bluetooth resources. * The object should not be used following a call to close * <p> * Shutdown method is intended to allow a clean Bluetooth state at program exist. * </p> */ public void shutdown(); }
<reponame>colorstheforce/contracts<filename>test/drafts/lists/OrderedSet.test.ts<gh_stars>100-1000 // tslint:disable-next-line:no-var-requires const { expectRevert } = require('@openzeppelin/test-helpers'); import { should } from 'chai'; import { OrderedSetMockInstance } from '../../../types/truffle-contracts'; const OrderedSet = artifacts .require('./drafts/lists/mocks/OrderedSetMock.sol') as Truffle.Contract<OrderedSetMockInstance>; should(); const empty = '0x0000000000000000000000000000000000000000'; const head = '0x0000000000000000000000000000000000000001'; const middle = '0x0000000000000000000000000000000000000002'; const tail = '0x0000000000000000000000000000000000000003'; /** @test {OrderedSet} contract */ contract('OrderedSet', (accounts) => { let orderedSet: OrderedSetMockInstance; beforeEach(async () => { orderedSet = await OrderedSet.new(); }); /* it('set an address as Head.', async () => { const event = ( await orderedSet.testSetHead(head) ).logs[0]; event.event.should.be.equal('NewHead'); event.args.item.should.be.equal(head); (await orderedSet.testHead()).should.be.equal(head); }); it('set an address as Tail.', async () => { const event = ( await orderedSet.testSetTail(tail) ).logs[0]; event.event.should.be.equal('NewTail'); event.args.item.should.be.equal(tail); (await orderedSet.testTail()).should.be.equal(tail); }); it('appends an item.', async () => { await orderedSet.testInsert(empty, head, empty); await orderedSet.testInsert(head, tail, empty); (await orderedSet.testContains(head)).should.be.true; (await orderedSet.testContains(tail)).should.be.true; (await orderedSet.testPrev(head)).should.be.equal(empty); (await orderedSet.testNext(head)).should.be.equal(tail); (await orderedSet.testPrev(tail)).should.be.equal(head); (await orderedSet.testNext(tail)).should.be.equal(empty); (await orderedSet.testHead()).should.be.equal(head); (await orderedSet.testTail()).should.be.equal(tail); }); it('prepends an item.', async () => { await orderedSet.testInsert(empty, tail, empty); await orderedSet.testInsert(empty, head, tail); (await orderedSet.testContains(head)).should.be.true; (await orderedSet.testContains(tail)).should.be.true; (await orderedSet.testPrev(head)).should.be.equal(empty); (await orderedSet.testNext(head)).should.be.equal(tail); (await orderedSet.testPrev(tail)).should.be.equal(head); (await orderedSet.testNext(tail)).should.be.equal(empty); (await orderedSet.testHead()).should.be.equal(head); (await orderedSet.testTail()).should.be.equal(tail); }); */ it('can\'t append the empty address.', async () => { await expectRevert( orderedSet.testAppend(empty), 'OrderedSet: Cannot insert the empty address', ); }); it('appends the first item.', async () => { await orderedSet.testAppend(head); (await orderedSet.testContains(head)).should.be.true; (await orderedSet.testNext(head)).should.be.equal(empty); (await orderedSet.testPrev(head)).should.be.equal(empty); (await orderedSet.testHead()).should.be.equal(head); (await orderedSet.testTail()).should.be.equal(head); }); it('can\'t append an existing item.', async () => { await orderedSet.testAppend(head); await expectRevert( orderedSet.testAppend(head), 'OrderedSet: Cannot insert an existing item', ); }); it('append and prepend.', async () => { await orderedSet.testAppend(middle); await orderedSet.testPrepend(head); await orderedSet.testAppend(tail); (await orderedSet.testContains(head)).should.be.true; (await orderedSet.testContains(middle)).should.be.true; (await orderedSet.testContains(tail)).should.be.true; (await orderedSet.testPrev(head)).should.be.equal(empty); (await orderedSet.testNext(head)).should.be.equal(middle); (await orderedSet.testPrev(middle)).should.be.equal(head); (await orderedSet.testNext(middle)).should.be.equal(tail); (await orderedSet.testPrev(tail)).should.be.equal(middle); (await orderedSet.testNext(tail)).should.be.equal(empty); (await orderedSet.testHead()).should.be.equal(head); (await orderedSet.testTail()).should.be.equal(tail); }); it('contains can return false.', async () => { await orderedSet.testAppend(head); (await orderedSet.testContains(tail)).should.be.false; }); it('can\'t remove the empty address.', async () => { await expectRevert( orderedSet.testRemove(empty), 'OrderedSet: Cannot remove the empty address', ); }); it('can\'t remove a non existing item.', async () => { await expectRevert( orderedSet.testRemove(head), 'OrderedSet: Cannot remove a non existing item', ); }); it('removes the only item.', async () => { await orderedSet.testAppend(head); await orderedSet.testRemove(head); (await orderedSet.testContains(head)).should.be.false; (await orderedSet.testNext(head)).should.be.equal(empty); (await orderedSet.testPrev(head)).should.be.equal(empty); (await orderedSet.testHead()).should.be.equal(empty); (await orderedSet.testTail()).should.be.equal(empty); }); it('removes the tail.', async () => { await orderedSet.testAppend(head); await orderedSet.testAppend(tail); await orderedSet.testRemove(tail); (await orderedSet.testContains(head)).should.be.true; (await orderedSet.testContains(tail)).should.be.false; (await orderedSet.testNext(head)).should.be.equal(empty); (await orderedSet.testPrev(head)).should.be.equal(empty); (await orderedSet.testHead()).should.be.equal(head); (await orderedSet.testTail()).should.be.equal(head); }); it('removes the head.', async () => { await orderedSet.testAppend(head); await orderedSet.testAppend(tail); await orderedSet.testRemove(head); (await orderedSet.testContains(head)).should.be.false; (await orderedSet.testContains(tail)).should.be.true; (await orderedSet.testNext(tail)).should.be.equal(empty); (await orderedSet.testPrev(tail)).should.be.equal(empty); (await orderedSet.testHead()).should.be.equal(tail); (await orderedSet.testTail()).should.be.equal(tail); }); it('removes the middle.', async () => { await orderedSet.testAppend(head); await orderedSet.testAppend(middle); await orderedSet.testAppend(tail); await orderedSet.testRemove(middle); (await orderedSet.testContains(head)).should.be.true; (await orderedSet.testContains(middle)).should.be.false; (await orderedSet.testContains(tail)).should.be.true; (await orderedSet.testPrev(head)).should.be.equal(empty); (await orderedSet.testNext(head)).should.be.equal(tail); (await orderedSet.testPrev(tail)).should.be.equal(head); (await orderedSet.testNext(tail)).should.be.equal(empty); (await orderedSet.testHead()).should.be.equal(head); (await orderedSet.testTail()).should.be.equal(tail); }); it('length.', async () => { (await orderedSet.testLength()).toNumber().should.be.equal(0); await orderedSet.testAppend(head); (await orderedSet.testLength()).toNumber().should.be.equal(1); await orderedSet.testAppend(tail); (await orderedSet.testLength()).toNumber().should.be.equal(2); await orderedSet.testRemove(head); (await orderedSet.testLength()).toNumber().should.be.equal(1); await orderedSet.testRemove(tail); (await orderedSet.testLength()).toNumber().should.be.equal(0); }); it('Retrieve an empty array', async () => { (await orderedSet.testEnumerate()).length.should.equal(0); }); it('Retrieve an array of values', async () => { await orderedSet.testAppend(head); await orderedSet.testAppend(middle); await orderedSet.testAppend(tail); const result = (await orderedSet.testEnumerate()); result.length.should.equal(3); result[0].should.equal(head); result[1].should.equal(middle); result[2].should.equal(tail); }); });
#!/bin/bash # Run integration tests against deployed app # Will test local dev by default, but pass command line arg # "stage" or "production" to test remote systems cd "$(dirname "$0")/.." source ./bin/lib/strict_mode.sh case "$1" in stage) pro=stage.peterlyons.com pers=stage.peterlyons.org ;; production) pro=peterlyons.com pers=peterlyons.org ;; *) pro=localhost:9000 pers=localhost:9001 ;; esac URL="${pro}" mocha app/integration-tests.js URL="${pers}" mocha app/personal/integration-tests.js
import math class CenterColumnShieldHyperbola: def __init__(self, height, inner_radius, mid_radius, outer_radius): self.height = height self.inner_radius = inner_radius self.mid_radius = mid_radius self.outer_radius = outer_radius def solid(self): if not self._is_valid_hyperbola(): raise ValueError("Invalid hyperbolic shape parameters") # Implement the solid representation generation based on the hyperbolic shape parameters # Return the solid representation def _is_valid_hyperbola(self): # Check if the parameters form a valid hyperbolic shape if self.inner_radius >= self.mid_radius or self.mid_radius >= self.outer_radius: return False return True def incorrect_inner_radius1(): test_shape = CenterColumnShieldHyperbola( height=100, inner_radius=101, mid_radius=80, outer_radius=100 ) test_shape.solid() def incorrect_inner_radius2(): test_shape = CenterColumnShieldHyperbola( height=100, inner_radius=50, mid_radius=80, outer_radius=49 ) test_shape.solid() # Test cases to ensure ValueError is raised for invalid hyperbolic shape parameters # The test cases should be executed using a testing framework such as unittest or pytest # Example using unittest: # self.assertRaises(ValueError, incorrect_inner_radius1) # self.assertRaises(ValueError, incorrect_inner_radius2)
def length_longest_word(s): longest_word = "" longest_len = 0 words = s.split() for word in words: if len(word) > longest_len: longest_len = len(word) longest_word = word return len(longest_word) result = length_longest_word(string) print(result)
function processFormData($array) { $data = []; foreach ($array as $key => $rs) { if ($rs['type'] == 'select' || $rs['type'] == 'checkbox') { $detail = explode("\n", $rs['options']); $opt = []; foreach ($detail as $value) { $opt[$value] = $value; } $data[$key] = $opt; } else { $data[$key] = $rs['value']; // Assuming 'value' is the field value } } return $data; }
<filename>_src/org/testobject/matcher/Any.java package org.testobject.matcher; /** * Matcher that match anything. * * @author <NAME> * */ public class Any implements Matcher { /** * Single instance for the Any matcher. */ public static Any ANY = new Any(); private Any() {} @Override public boolean matches(Object aActual) { return true; } }
class AdminAuctionStatusPresenter::OtherPcard::Accepted < AdminAuctionStatusPresenter::Base def header I18n.t('statuses.admin_auction_status_presenter.other_pcard.accepted.header') end def body I18n.t( 'statuses.admin_auction_status_presenter.other_pcard.accepted.body', customer_url: customer_url, accepted_at: accepted_at, winner_url: winner_url ) end def action_partial 'admin/auctions/mark_paid' end private def accepted_at DcTimePresenter.convert_and_format(auction.accepted_at) end def customer_url Url.new( link_text: customer_name, path_name: 'admin_customer', params: { id: customer.id } ) end def customer auction.customer end def customer_name customer.agency_name end end
import numpy as np gpu0 = gpu0 = np.array([25.63441038, 27.24829316, 27.39255691, 27.56735945, 28.32996345, 28.63213658, 28.58860159, 28.68968606, 28.80927539, 28.88868928, 28.85548854, 28.84945774, 28.90495086, 29.00500917, 28.96139503, 29.01055098, 29.0174129 , 28.9026475 , 28.95669127, 28.95496225, 28.94913101, 29.0056448 , 28.97974443, 29.03227663, 29.06991339, 29.09832525, 29.03788805, 29.0432725 , 29.09519172, 29.03311467, 29.1265924 , 29.11275077, 29.0749445 , 29.09178901, 29.12307882, 29.12946391, 29.10546303, 29.12261558, 29.11174798, 29.17591763, 29.15067387, 29.14894056, 29.19746375, 29.13743997, 29.10707831, 29.07725 , 29.09952712, 29.11963654, 29.11723185, 29.09348559, 29.10014725, 29.08170056, 29.13675714, 29.08055115, 29.05867076, 29.06814432, 29.08096981, 29.0365653 , 29.07654142, 29.09075546, 29.11795044, 29.10828424, 29.09472227, 29.10186672, 29.12374568, 29.08455849, 29.15070939, 29.1349647 , 29.16308808, 29.15958738, 29.17121553, 29.18009973, 29.15611196, 29.15433931, 29.17299199, 29.14850903, 29.13327599, 29.14142156, 29.14175892, 29.14895344, 29.12683415, 29.08453894, 29.09811521, 29.10174632, 29.11816478, 29.12261271, 29.14036942, 29.08892059, 29.16859102, 29.08967423, 29.11402106, 29.1327486 , 29.07833076, 29.15800047, 29.16186619, 29.14057016, 29.14026308, 29.13676763, 29.12212849, 29.14477944, 29.11433411, 29.11345696, 29.05566645, 29.1078043 , 29.11919069, 29.06876755, 29.03930354, 28.99757671, 29.00875068, 28.99138665, 29.06230998, 28.99707699, 29.00914931, 28.98399234, 28.99539804, 29.03849626, 29.00248718, 29.112113 , 28.9970119 , 29.15149236, 29.09549952, 29.12229037, 29.13915467, 29.14898968, 29.16338992, 29.14518213, 29.12777853, 29.0891571 , 29.12499738, 29.13985634, 29.12453413, 29.11786842, 28.74395299, 28.69149566, 28.64097238, 28.63286233, 28.62579799, 28.5829823 , 28.55535293, 28.55303812, 28.52619672, 28.5174458 , 28.49040675, 28.48029423, 28.4602046 , 28.4750905 , 28.48038697, 28.46763468, 28.48184538, 28.45552397, 28.42226648, 28.41999793, 28.43518066, 28.40847421, 28.42502761, 28.40868664, 28.43147326, 28.37357855, 28.38061261, 28.43349147, 28.44692612, 28.39129663, 28.39873672, 28.3700552 , 28.40747046, 28.39177728, 28.37942791, 28.41580033, 28.41804957, 28.39366674, 28.46219492, 28.41779637, 28.42391825, 28.4418242 , 28.41513062, 28.45100641, 28.46687579, 28.50098348, 28.46950364, 28.46516252, 28.50937057, 28.44665623, 28.43561435, 28.42969918, 28.48964286, 28.47383404, 28.43096328, 28.48000169, 28.40916657, 28.40207505, 28.37973833, 28.45017695, 28.33830476, 28.46451378, 28.40183663, 28.44102597, 28.39700985, 28.45411968, 28.45599413, 28.4714396 , 28.46428585, 28.40477777, 28.48196888, 28.46405029, 28.42254519, 28.46363997, 28.43975496, 28.43380976, 28.39601016, 28.42089105, 28.40069246, 28.47236848, 28.51523328, 28.48551702, 28.49408388, 28.47064662, 28.51317 , 28.42315102, 28.43903112, 28.46574688, 28.42889428, 28.46794486, 28.45739794, 28.41053724, 28.37761188, 28.42401528, 28.4655757 , 28.37959862, 28.38154387, 28.30566216, 28.31735873, 28.31403971, 28.33807564, 28.40114307, 28.41677785, 28.4201026 , 28.45534754, 28.45432353, 28.47530222, 28.48454928, 28.52218437, 28.47155356, 28.53071284, 28.50684667, 28.48922777, 28.51469445, 28.4787221 , 28.50052834, 28.47012639, 28.48194265, 28.49177122, 28.46056581, 28.46906996, 28.48018432, 28.44410729, 28.45667601, 28.5166626 , 28.5471375 , 28.52648115, 28.54092312, 28.50314713, 28.5552659 , 28.50151706, 28.55392694, 28.53030539, 28.50629234, 28.51491547, 28.51131463, 28.52011871, 28.50335217, 28.47501969, 28.49216175, 28.46708083, 28.47188425, 28.48051715, 28.47087383, 28.44904351, 28.50898051, 28.42972803, 28.45214772, 28.4281013 , 28.43040848, 28.396806 , 28.43688536, 28.37414098, 28.38145089, 28.36236072, 28.38088799, 28.46535921, 28.46952629, 28.44011617, 28.47323442, 28.38992834, 28.45535302, 28.46666193, 28.49729562, 28.45925975, 28.45546055, 28.48969078, 28.44934916, 28.45301127, 28.44600868, 28.39878654, 28.47149348, 28.45655251, 28.43274474, 28.47922492, 28.47446918, 28.49932671, 28.47877192, 28.49136901, 28.48902273, 28.50395513, 28.51035619, 28.55022812, 28.48115754, 28.4766264 , 28.53661704, 28.55031657, 28.50691843, 28.50900984, 28.49853945, 28.51143932, 28.48256207, 28.49539375, 28.44733572, 28.49413848, 28.54285669, 28.46119237, 28.46832395, 28.44989419, 28.45539141, 28.42408013, 28.40909243, 28.45267868, 28.36667943, 28.40319419, 28.4222064 , 28.38159418, 28.44097471, 28.44848228, 28.37344241, 28.41292429, 28.45192075, 28.38886261, 28.40060711, 28.40056252, 28.42376232, 28.39430571, 28.42576075, 28.44111753, 28.45962644, 28.51700783, 28.47618985, 28.47926378, 28.47167444, 28.45070124, 28.45624924, 28.45737195, 28.45580125, 28.42373109, 28.44147873, 28.43947887, 28.45488667, 28.44742346, 28.45131135, 28.39445853, 28.46120286, 28.44414139, 28.44205999, 28.41435838, 28.42030501, 28.44352198, 28.42908645, 28.40277624, 28.43861532, 28.44575524, 28.42462873, 28.42136359, 28.41723752, 28.42736411, 28.4358151 , 28.42709446, 28.39483786, 28.44440985, 28.41048622, 28.43490028, 28.37525749, 28.47399116, 28.44113183, 28.41529107, 28.43776011, 28.38504243, 28.41223288, 28.38248658, 28.38810492, 28.38711643, 28.35709 , 28.35162282, 28.34868979, 28.39008236, 28.3592062 , 28.36163235, 28.49044514, 28.41691947, 28.47844148, 28.37930799, 28.38082218, 28.4459343 , 28.47782111, 28.43245101, 28.45512867, 28.49686837, 28.49236202, 28.48591113, 28.51278305, 28.47237539, 28.49718165, 28.45827556, 28.45147181, 28.50057459, 28.45909166, 28.46477723, 28.50302315, 28.44950271, 28.50537801, 28.49339676, 28.46125793, 28.40261936, 28.41664243, 28.43133068, 28.44118166, 28.45375896, 28.47987008, 28.48068953, 28.48647189, 28.46143389, 28.54253888, 28.52305007, 28.54708719, 28.5252316 , 28.52987123, 28.48349953, 28.45895219, 28.47111988, 28.45241022, 28.4156096 , 28.45368648, 28.40030861, 28.40878272, 28.37093687, 28.35248089, 28.34736991, 28.31865501, 28.37069488, 28.35584855, 28.38765907, 28.39018154, 28.33919501, 28.38254786, 28.37020135, 28.38400578, 28.41598701, 28.36909914, 28.38543057, 28.39884782, 28.38775826, 28.39021015, 28.43805814, 28.44341373, 28.4608233 , 28.44162464, 28.45940685, 28.47882366, 28.46705317, 28.52201033, 28.49015641, 28.49159527, 28.48826623, 28.52879953, 28.50485516, 28.46478772, 28.41810417, 28.45541763, 28.46532655, 28.48654103, 28.46719527, 28.44157958, 28.42968202, 28.44130182, 28.46578193, 28.46481419, 28.45353389, 28.43246794, 28.43793392, 28.38370371, 28.3875773 , 28.43767381, 28.45526266, 28.43604994, 28.41586566, 28.38279462, 28.35058546, 28.39700174, 28.40006828, 28.35953856, 28.4349525 , 28.34278297, 28.35713243, 28.39201736, 28.37196779, 28.40198731, 28.36002922, 28.41137147, 28.3918066 , 28.41983581, 28.43905306, 28.4140687 , 28.44602799, 28.42579365, 28.42693448, 28.42390561, 28.41340327, 28.51030207, 28.47226715, 28.43695211, 28.43604302, 28.47450566, 28.40669489, 28.42649508, 28.43489647, 28.37275171, 28.40730476, 28.31135917, 28.35486841, 28.35431242, 28.38302946, 28.36621809, 28.40427399, 28.39326191, 28.42056274, 28.39625144, 28.37933421, 28.43307424, 28.43790746, 28.40258241, 28.44590425, 28.40089011, 28.38318205, 28.38088894, 28.39319944, 28.40686703, 28.43757725, 28.39661455, 28.40266538, 28.4449389 , 28.40513802, 28.48288369, 28.44681692, 28.40149093, 28.43002939, 28.44687438, 28.43548465, 28.4035027 , 28.430022 , 28.42900753, 28.46166849, 28.43553734, 28.39811397, 28.39519 , 28.46808362, 28.43905091, 28.41979527, 28.4544127 , 28.43596315, 28.43966508, 28.46689916, 28.43291664, 28.44674635, 28.45132852, 28.50772381, 28.47196436, 28.41991138, 28.46535659, 28.37999129, 28.39848351, 28.40613461, 28.39815593, 28.40418839, 28.35901833, 28.34054136, 28.36758089, 28.3587203 , 28.34081078, 28.3552494 , 28.30567431, 28.31660914, 28.33592105, 28.36427307, 28.33230424, 28.35563254, 28.34447312, 28.3329308 , 28.35418487, 28.32736611, 28.36809444, 28.38906193, 28.36183953, 28.35202861, 28.4138031 , 28.44679546, 28.3990016 , 28.43932486, 28.44638586, 28.4848876 , 28.4588933 , 28.50235295, 28.47739887, 28.44701624, 28.47532201, 28.50052881, 28.47645974, 28.47231889, 28.43656492, 28.42742586, 28.47832918, 28.40753627, 28.49511552, 28.47375393, 28.47448397, 28.50249624, 28.44211817, 28.51133561, 28.48576474, 28.52217722, 28.46787643, 28.48974252, 28.50205684, 28.48331094, 28.48983884, 28.52571583, 28.54290104, 28.51441193, 28.51010799, 28.46923327, 28.45647788, 28.444484 , 28.43453646, 28.46513486, 28.45884895, 28.46806145, 28.43693638, 28.43032265, 28.41371584, 28.39567804, 28.35865474, 28.37215972, 28.37798691, 28.36841583, 28.34747791, 28.34269357, 28.35176611, 28.41931725, 28.40645266, 28.35266471, 28.44926739, 28.42814827, 28.43122101, 28.46931458, 28.46166253, 28.4962616 , 28.46940756, 28.46648932, 28.46684027, 28.4864943 , 28.44117951, 28.46384645, 28.49327564, 28.50660253, 28.48096395, 28.43229771, 28.42534709, 28.43010402, 28.42222571, 28.4949739 , 28.42009902, 28.44221497, 28.41876245, 28.41813254, 28.42910337, 28.48547721, 28.45624065, 28.45421791, 28.46231413, 28.44970179, 28.48597765, 28.43224669, 28.42124844, 28.46430087, 28.4966948 , 28.47284222, 28.45932174, 28.5362711 , 28.51850009, 28.50627565, 28.55069399, 28.48906565, 28.52356768, 28.51309681, 28.48933434, 28.52784681, 28.46621251, 28.48226261, 28.47054887, 28.51291323, 28.47430801, 28.4547646 , 28.4719727 , 28.40180492, 28.44958544, 28.43648291, 28.41957545, 28.47183609, 28.36418962, 28.39437318, 28.41493893, 28.39758849, 28.40499306, 28.40677428, 28.41775799, 28.44649982, 28.46338749, 28.44942617, 28.47095585, 28.41364098, 28.50723362, 28.52434826, 28.47592831, 28.51641631, 28.51183844, 28.48848724, 28.53509355, 28.5622735 , 28.47734094, 28.53871107, 28.52983236, 28.50474 , 28.56513238, 28.49059463, 28.51530433, 28.49213171, 28.51201177, 28.50095606, 28.49383283, 28.4629271 , 28.49640846, 28.45467186, 28.53133845, 28.47559643, 28.4653306 , 28.46760941, 28.41579866, 28.49863005, 28.50288916, 28.48974633, 28.49267721, 28.49098706, 28.52665854, 28.46112847, 28.52223635, 28.50275755, 28.43345642, 28.41357517, 28.41281676, 28.40851974, 28.44092202, 28.41534925, 28.41852188, 28.41100383, 28.43156362, 28.42954326, 28.44407201, 28.38617277, 28.41848016, 28.46660733, 28.42216969, 28.41982841, 28.47543979, 28.48117018, 28.41919708, 28.43492508, 28.45231032, 28.49405217, 28.44267678, 28.47001553, 28.45082188, 28.53914046, 28.51760864, 28.48496795, 28.52735329, 28.47688794, 28.54379749, 28.54632282, 28.50179601, 28.52556252, 28.5207479 , 28.4842267 , 28.49505758, 28.4694736 , 28.48511076, 28.43339157, 28.50464296, 28.46718812, 28.44614244, 28.47207618, 28.47473741, 28.48800969, 28.45392013, 28.49384451, 28.50109339, 28.46757746, 28.55565906, 28.50944781, 28.5067606 , 28.50734568, 28.53940248, 28.49659967, 28.55280852, 28.49862385, 28.49918079, 28.51767516, 28.56489944, 28.52271843, 28.44949532, 28.50114608, 28.53058338, 28.5079155 , 28.52790618, 28.46909738, 28.49778461, 28.48157644, 28.4946239 , 28.50289559, 28.436975 , 28.50068688, 28.49297166, 28.47203493, 28.4597857 , 28.44686818, 28.43343544, 28.4840951 , 28.45447206, 28.47975421, 28.4928062 , 28.38574171, 28.46777844, 28.50589132, 28.49997807, 28.48169446, 28.45035815, 28.49186325, 28.51654935, 28.48564744, 28.46859264, 28.51882982, 28.5055027 , 28.51615763, 28.50846386, 28.44123054, 28.47870398, 28.4803741 , 28.4746902 , 28.48093629, 28.48647857, 28.48978162, 28.44173956, 28.43555379, 28.41267395, 28.42195606, 28.44197583, 28.43640208, 28.38285613, 28.38088965, 28.40595555, 28.4316051 , 28.4259007 , 28.39100623, 28.44209456, 28.43156362, 28.41420555, 28.38876605, 28.4183526 , 28.42471766, 28.4243567 , 28.37590551, 28.45179486, 28.43991613, 28.47431588, 28.44536996, 28.49032736, 28.50697684, 28.50584483, 28.54594183, 28.51164651, 28.52874351, 28.47387934, 28.50449538, 28.48458338, 28.45710945, 28.48413682, 28.48135281, 28.3926127 , 28.49389172, 28.53791189, 28.49471664, 28.59479833, 28.52804017, 28.57763243, 28.55608225, 28.58253455, 28.63408518, 28.60134816, 28.6273787 , 28.65099335, 28.51119041, 28.58099818, 28.57649803, 28.59362316, 28.57381916, 28.52452183, 28.57119942, 28.53822327, 28.51403117, 28.49785876, 28.52568674, 28.53487086, 28.55076981, 28.87558556, 28.99268174, 28.97828245, 28.97886491, 28.98476028, 28.89376211, 29.07379079, 29.22934604, 29.2288754 , 29.23139811, 29.21830177, 29.21449447, 29.2225914 , 29.21692634, 29.21098638, 29.21099591, 29.19391656, 29.20186973, 29.20103192, 29.19688654, 29.1968112 , 29.18937039, 29.00173569, 28.82575464, 28.67503572, 28.51759863, 28.43446708, 28.35872173, 28.33898354, 28.24778724, 28.47668791, 28.44461083, 28.37440801, 28.39213347, 28.33639169, 28.29273462, 28.31722021, 28.3180666 , 28.29050279, 28.30683184, 28.27479243, 28.33650565, 28.26307011, 28.20938706, 28.22148252, 28.24339485, 28.20171809, 28.14651179, 28.15368915, 28.16223097, 28.25027347, 28.16891909, 28.24759817, 28.22099185, 28.19393134, 28.16113806, 28.21944261, 28.14242029, 28.18995619, 28.13224673, 28.11991024, 28.15540743, 28.11317229]) gpu1 = np.array([25.43153071, 27.15162516, 27.32131648, 27.38970256, 27.42152667, 27.4488349 , 27.45549154, 27.45302224, 27.43057394, 27.43361497, 27.41842961, 27.43521523, 27.43591571, 27.41891098, 27.41720986, 27.39959407, 27.41164064, 27.40155792, 27.37060618, 27.38735008, 27.37486458, 27.36827588, 27.36324573, 27.37758183, 27.34998751, 27.36711073, 27.36944222, 27.37568927, 27.35006189, 27.34807491, 27.36034393, 27.37914848, 27.37782812, 27.38069129, 27.37261724, 27.38491392, 27.35329819, 27.36592507, 27.3524251 , 27.36936903, 27.37010241, 27.38678002, 27.38478088, 27.38209224, 27.38314414, 27.36580348, 27.37267232, 27.36294103, 27.37009859, 27.34886217, 27.35752225, 27.33365107, 27.33703685, 27.33012033, 27.34590721, 27.34462857, 27.3395288 , 27.32349253, 27.32426882, 27.33189344, 27.32304311, 27.3256073 , 27.33233547, 27.32025814, 27.32708383, 27.35108161, 27.3516221 , 27.34549403, 27.34642196, 27.34096313, 27.34470487, 27.33595014, 27.33726883, 27.33082438, 27.33472848, 27.32437587, 27.33326674, 27.31176758, 27.31412482, 27.31439829, 27.29975343, 27.31098723, 27.31704259, 27.31839085, 27.31053329, 27.32217264, 27.32582378, 27.31890416, 27.3148911 , 27.32820034, 27.34550691, 27.33213139, 27.31708741, 27.31586432, 27.30660772, 27.30505991, 27.3124702 , 27.30109358, 27.29958415, 27.30246019, 27.30213785, 27.30090666, 27.29130411, 27.29306102, 27.29891825, 27.29744983, 27.3135612 , 27.31484485, 27.2987659 , 27.2938447 , 27.3147068 , 27.29132915, 27.31099725, 27.32183242, 27.30488729, 27.29337668, 27.32147551, 27.29213929, 27.31325316, 27.29817104, 27.29871297, 27.29544997, 27.29702282, 27.3089366 , 27.30508137, 27.29581976, 27.29746985, 27.29318714, 27.29952884, 27.28448701, 27.27464414, 27.29217815, 27.28442478, 27.2814579 , 27.27501607, 27.29015017, 27.29175496, 27.29118299, 27.28478265, 27.29994798, 27.28948092, 27.27993464, 27.27732491, 27.28020644, 27.2731359 , 27.29375291, 27.26915216, 27.25029874, 27.25307703, 27.25264621, 27.26752448, 27.26396465, 27.26657748, 27.26096916, 27.28805113, 27.26475644, 27.26933312, 27.27726269, 27.26053333, 27.26731014, 27.25547457, 27.25600314, 27.25534654, 27.25754833, 27.24898958, 27.25627828, 27.25274324, 27.25478697, 27.25581217, 27.25077152, 27.24354911, 27.24430656, 27.24173045, 27.2529664 , 27.21921301, 27.22214413, 27.22927213, 27.2369535 , 27.26293945, 27.24365306, 27.24564719, 27.24989009, 27.24407792, 27.2372365 , 27.23223472, 27.23865318, 27.24898934, 27.25757337, 27.25854373, 27.24890566, 27.25862002, 27.24693227, 27.26199532, 27.24102473, 27.2453723 , 27.26616621, 27.24214387, 27.23553658, 27.24743199, 27.26929593, 27.25648904, 27.24395323, 27.25478578, 27.25242186, 27.25839949, 27.27291489, 27.26591706, 27.24833775, 27.26033592, 27.26586962, 27.25678611, 27.24986148, 27.24709749, 27.23703742, 27.23326445, 27.25490856, 27.2447648 , 27.23307681, 27.21994138, 27.24827623, 27.25848794, 27.24819064, 27.24702024, 27.24340892, 27.25770092, 27.23338318, 27.24983454, 27.23494768, 27.22907543, 27.21880269, 27.20413065, 27.20925164, 27.21967435, 27.2220006 , 27.20519638, 27.20685315, 27.21071315, 27.21720266, 27.20749021, 27.19857502, 27.1800735 , 27.19849062, 27.18969512, 27.19906187, 27.20223618, 27.20472717, 27.19299626, 27.19305062, 27.20094991, 27.20792866, 27.20703197, 27.20369005, 27.20001292, 27.22752881, 27.21691918, 27.21540475, 27.23336458, 27.21125388, 27.212147 , 27.22870183, 27.22636271, 27.20860362, 27.23640919, 27.24873614, 27.22722268, 27.23023772, 27.22085452, 27.23815918, 27.22229648, 27.21345067, 27.2119658 , 27.22016335, 27.23666811, 27.22386789, 27.20851183, 27.19867849, 27.19888806, 27.2192266 , 27.20219231, 27.20676851, 27.20637131, 27.21103597, 27.22136927, 27.22396541, 27.21719527, 27.2104857 , 27.20013213, 27.21078706, 27.21248269, 27.20280027, 27.19754791, 27.2027595 , 27.20538163, 27.20295286, 27.2229805 , 27.22726083, 27.21362352, 27.21738935, 27.23313189, 27.27267361, 27.24450231, 27.2544775 , 27.24814987, 27.24666452, 27.25802064, 27.27488136, 27.26202536, 27.25674796, 27.27440786, 27.26890063, 27.24438596, 27.24644613, 27.25454259, 27.24619722, 27.24155641, 27.24123001, 27.25622916, 27.26509213, 27.27894473, 27.2441318 , 27.24385738, 27.26053166, 27.25468612, 27.26605129, 27.25685668, 27.26417518, 27.2598021 , 27.27184963, 27.27474952, 27.28039694, 27.27247095, 27.27238584, 27.2750442 , 27.27533603, 27.27904844, 27.26133227, 27.26544333, 27.25883937, 27.26970363, 27.28742361, 27.29820919, 27.27642226, 27.2796104 , 27.26858473, 27.27417541, 27.27487373, 27.27340817, 27.25722051, 27.25680971, 27.2671597 , 27.27814603, 27.29805303, 27.29160523, 27.29633355, 27.30512595, 27.28144217, 27.28556871, 27.28518772, 27.26968408, 27.28717828, 27.27661371, 27.28395772, 27.27936172, 27.28174758, 27.29238439, 27.28720331, 27.29545951, 27.28586864, 27.28450656, 27.29225206, 27.30837655, 27.30622578, 27.27383113, 27.27298284, 27.29015708, 27.27301526, 27.28953528, 27.26282525, 27.26558495, 27.27437115, 27.28167772, 27.26834631, 27.26689172, 27.29075027, 27.27934384, 27.2782948 , 27.27424645, 27.26883531, 27.27286077, 27.29054046, 27.28542256, 27.27696276, 27.28256249, 27.29796243, 27.28560185, 27.28879809, 27.28709435, 27.28058147, 27.28242564, 27.27374244, 27.27801681, 27.27014589, 27.28688717, 27.26693058, 27.26084352, 27.26634645, 27.28321123, 27.26426649, 27.25875974, 27.25588179, 27.24673128, 27.25172067, 27.2494607 , 27.23783183, 27.23736858, 27.23029089, 27.22044015, 27.26249599, 27.2679801 , 27.25670481, 27.26443958, 27.26687074, 27.2693038 , 27.25420761, 27.26888633, 27.26420236, 27.28845167, 27.28399563, 27.29453492, 27.28735471, 27.2921083 , 27.29966927, 27.28700471, 27.2651155 , 27.27408552, 27.28532004, 27.28840494, 27.29770899, 27.28106689, 27.26464295, 27.26141167, 27.27240396, 27.2723825 , 27.26605487, 27.26722145, 27.26625609, 27.26599717, 27.25055504, 27.25804019, 27.28070974, 27.25738907, 27.25662112, 27.24868727, 27.25597668, 27.24475479, 27.27149725, 27.2622745 , 27.26885438, 27.25936913, 27.25824404, 27.27370524, 27.26691055, 27.26541233, 27.25587344, 27.26844239, 27.26049185, 27.24386144, 27.24847627, 27.23518252, 27.25925255, 27.24098349, 27.24470234, 27.26550627, 27.28380466, 27.29644728, 27.29530191, 27.26675439, 27.2712779 , 27.27780294, 27.26023054, 27.24734235, 27.25284314, 27.25538254, 27.27753496, 27.26957083, 27.26405811, 27.28609657, 27.27295685, 27.26188111, 27.27865601, 27.26863599, 27.25653434, 27.2675283 , 27.25175977, 27.27901268, 27.2832284 , 27.26530457, 27.26145411, 27.2623508 , 27.24670434, 27.25552297, 27.24853539, 27.25191045, 27.24459124, 27.23440313, 27.22873235, 27.2271812 , 27.23588991, 27.2296083 , 27.21409011, 27.22235727, 27.2314961 , 27.2288723 , 27.23379755, 27.24204159, 27.25017452, 27.23835611, 27.22798634, 27.20323706, 27.22560287, 27.22800207, 27.22823405, 27.22077918, 27.19909811, 27.21126795, 27.21173596, 27.21307015, 27.20399594, 27.20827055, 27.20030355, 27.1962533 , 27.19777918, 27.20806026, 27.21058464, 27.21446157, 27.21739149, 27.2234571 , 27.24280381, 27.23787117, 27.21224356, 27.21612787, 27.21974826, 27.22334266, 27.22491574, 27.23277831, 27.22289753, 27.21497798, 27.21490264, 27.21899652, 27.21936655, 27.22669029, 27.21770096, 27.21487284, 27.2209506 , 27.22643876, 27.20259714, 27.20218229, 27.2120285 , 27.21759534, 27.22001243, 27.22026014, 27.24013638, 27.23425937, 27.2252872 , 27.22585011, 27.23284841, 27.2471087 , 27.25668073, 27.27185917, 27.26777244, 27.2384212 , 27.24553347, 27.24961853, 27.25031638, 27.24579453, 27.24922013, 27.24098301, 27.2390604 , 27.25309587, 27.24056005, 27.24419832, 27.24579287, 27.25803185, 27.24540949, 27.24424958, 27.22878218, 27.21794152, 27.2263546 , 27.21162724, 27.21386313, 27.23658037, 27.22368503, 27.22740006, 27.22748184, 27.22986317, 27.23403072, 27.2322197 , 27.2401185 , 27.22717094, 27.22962165, 27.24385333, 27.24206829, 27.23158884, 27.2334125 , 27.26068163, 27.2589829 , 27.25048256, 27.24830532, 27.26032066, 27.27383471, 27.25041366, 27.24794579, 27.2304039 , 27.23179793, 27.2262423 , 27.2322588 , 27.23616028, 27.22912192, 27.22391367, 27.22389221, 27.22340012, 27.22457051, 27.22722793, 27.22529101, 27.2077148 , 27.23189664, 27.2165513 , 27.21656346, 27.23593879, 27.20660305, 27.23262024, 27.24214888, 27.24863648, 27.24137473, 27.25596142, 27.24183941, 27.26286173, 27.25409007, 27.2468946 , 27.25281358, 27.25980902, 27.25893903, 27.2529881 , 27.25773191, 27.25196075, 27.2524178 , 27.23628068, 27.23641348, 27.25365162, 27.23985314, 27.24447107, 27.24825764, 27.24628258, 27.24841166, 27.24804926, 27.23626065, 27.22635174, 27.24703312, 27.23835874, 27.23152065, 27.23587489, 27.23452687, 27.23988867, 27.24889302, 27.23997879, 27.25933695, 27.24372172, 27.25025368, 27.25009179, 27.24631357, 27.25365901, 27.23446536, 27.24851727, 27.25430059, 27.24432778, 27.2422421 , 27.2472713 , 27.25278831, 27.24026179, 27.24608612, 27.23825717, 27.24682426, 27.24600577, 27.24372721, 27.22252345, 27.23718286, 27.21422482, 27.22329831, 27.23769355, 27.23872209, 27.24354649, 27.24367619, 27.23500824, 27.23615885, 27.23684883, 27.24210882, 27.23988771, 27.25610089, 27.23996186, 27.23644972, 27.23881912, 27.26313615, 27.27148247, 27.25958467, 27.2660594 , 27.26225281, 27.25168657, 27.25979924, 27.25494003, 27.24866581, 27.24982643, 27.24283481, 27.24953985, 27.25442982, 27.25652838, 27.23830509, 27.24100304, 27.23696828, 27.23247433, 27.24463105, 27.21371555, 27.23315334, 27.2193141 , 27.23463154, 27.23665571, 27.22741103, 27.22904801, 27.24401021, 27.24555492, 27.25555491, 27.25523233, 27.2293489 , 27.22402501, 27.224401 , 27.2259357 , 27.22216892, 27.21565175, 27.23094487, 27.23519588, 27.21535826, 27.22629976, 27.20387673, 27.24467921, 27.23668242, 27.22767234, 27.22661138, 27.22173357, 27.21628976, 27.21996689, 27.21865082, 27.19892502, 27.19713759, 27.19978476, 27.20216298, 27.21146441, 27.20712733, 27.21926856, 27.24632382, 27.22614121, 27.21427822, 27.21565175, 27.22416329, 27.22241378, 27.21529841, 27.2465632 , 27.21782303, 27.21845984, 27.22282791, 27.22899079, 27.22555542, 27.24338603, 27.2288363 , 27.24480772, 27.25383282, 27.24162865, 27.23538756, 27.243361 , 27.23586178, 27.2424221 , 27.23898745, 27.24630713, 27.25415301, 27.27242684, 27.24130964, 27.24270296, 27.26196027, 27.27200198, 27.27484179, 27.25235677, 27.26209283, 27.27247286, 27.27480745, 27.2644434 , 27.27200508, 27.26183891, 27.25927305, 27.26185346, 27.26574945, 27.26832557, 27.27080727, 27.27621603, 27.26170325, 27.27072716, 27.26665568, 27.26903605, 27.28858018, 27.26582122, 27.25969625, 27.26603222, 27.24014544, 27.24721813, 27.24265766, 27.24400568, 27.23351884, 27.23096371, 27.22384858, 27.23224878, 27.23146224, 27.24140334, 27.2385273 , 27.24464393, 27.25469494, 27.23783898, 27.25314474, 27.25188994, 27.25776553, 27.24965978, 27.25078487, 27.25086617, 27.26166201, 27.27078056, 27.26551676, 27.2612381 , 27.2576921 , 27.24420476, 27.2465167 , 27.26618099, 27.25290704, 27.2605567 , 27.25767589, 27.25368309, 27.28233647, 27.26979709, 27.2740736 , 27.26521039, 27.2646451 , 27.26002693, 27.28260684, 27.26536179, 27.26891184, 27.26312971, 27.26043391, 27.27354646, 27.25264835, 27.24667907, 27.23774457, 27.25329781, 27.24753499, 27.26739907, 27.26440549, 27.25687861, 27.24987411, 27.25192642, 27.2485435 , 27.21911693, 27.23984146, 27.22270632, 27.22932863, 27.22943878, 27.23752356, 27.24659634, 27.2337935 , 27.23395228, 27.22785854, 27.23043871, 27.24157166, 27.2521987 , 27.24949765, 27.24223709, 27.23476815, 27.23637819, 27.23633599, 27.23260617, 27.24561906, 27.23688555, 27.25819182, 27.24158096, 27.25167847, 27.23153043, 27.24289989, 27.23982406, 27.23478079, 27.23435163, 27.24419975, 27.22536707, 27.22690964, 27.26051831, 27.24154472, 27.24543977, 27.26663399, 27.25189543, 27.23236918, 27.24515057, 27.26379418, 27.26032495, 27.25104952, 27.24910164, 27.25163126, 27.24697113, 27.26309276, 27.26477718, 27.25996995, 27.26450157, 27.24932241, 27.24379921, 27.24404764, 27.24170089, 27.24824786, 27.24243522, 27.24456453, 27.26146173, 27.25571465, 27.24053979, 27.25563574, 27.22014093, 27.2261889 , 27.2266953 , 27.22748566, 27.23307967, 27.22243357, 27.25277591, 27.23409629, 27.21820951, 27.20876765, 27.21760082, 27.21139407, 27.20908356, 27.21374393, 27.22753263, 27.23278952, 27.24981284, 27.22387719, 27.2467804 , 27.23925281, 27.24087548, 27.22403908, 27.23331594, 27.23253536, 27.23461699, 27.22750115, 27.23860979, 27.23329496, 27.2371552 , 27.21923971, 27.23234105, 27.25231767, 27.23859763, 27.23597455, 27.256464 , 27.25292063, 27.2587254 , 27.27486706, 27.255234 , 27.26212358, 27.23896742, 27.22098064, 27.24533486, 27.23565602, 27.24041271, 27.23561931, 27.23289013, 27.23756862, 27.21549606, 27.22157001, 27.23250008, 27.22198081, 27.21059346, 27.22264409, 27.20789194, 27.2296586 , 27.21186638, 27.22954965, 27.25347829, 27.24595237, 27.24100423, 27.2457118 , 27.25613832, 27.26448011, 27.28834939, 27.3004632 , 27.28629589, 27.29881883, 27.30026126, 27.293679 , 27.28173113, 27.2953341 , 27.28887796, 27.29174352, 27.29013062, 27.307019 ]) gpu2 = np.array([25.00686646, 26.66244483, 26.84275866, 27.02287173, 27.04904675, 27.06761599, 27.09353065, 27.0651474 , 27.04664779, 27.05055285, 27.0268836 , 27.02275205, 27.02586269, 27.03594947, 27.02324986, 27.01567435, 27.01999426, 27.02166057, 27.0127964 , 27.01459146, 26.99833918, 27.01545215, 26.98873067, 26.98876595, 26.99850464, 26.98268294, 26.9794538 , 26.99160981, 26.98596001, 26.99175525, 27.00050068, 26.98281169, 26.98093581, 26.98785877, 26.98458958, 26.97706079, 26.97081685, 26.96270275, 26.97636342, 26.97920799, 26.97131276, 26.9632082 , 26.95253754, 26.95932746, 26.94958949, 26.93959045, 26.94081092, 26.95653963, 26.95870852, 26.96141315, 26.96014619, 26.95317268, 26.93288493, 26.95912194, 26.9389956 , 26.94529819, 26.9425211 , 26.94357371, 26.93860269, 26.92895436, 26.93509459, 26.93176866, 26.93075132, 26.95057893, 26.96003747, 26.95372653, 26.95311856, 26.95090556, 26.96273589, 26.9675951 , 26.96341395, 26.96893835, 26.95323801, 26.94867039, 26.95614362, 26.96364141, 26.96503782, 26.96280622, 26.94858074, 26.96383214, 26.960356 , 26.94584823, 26.94223356, 26.93645525, 26.93587017, 26.93280602, 26.91569638, 26.9337821 , 26.92422676, 26.91849899, 26.9149034 , 26.92688036, 26.91858292, 26.92871928, 26.91174006, 26.91581082, 26.93607688, 26.9334178 , 26.93454981, 26.9316926 , 26.93548441, 26.92890143, 26.93750381, 26.93863773, 26.93947172, 26.92670679, 26.9274385 , 26.94561529, 26.93595791, 26.92985368, 26.92335463, 26.93357372, 26.93756175, 26.9356389 , 26.92527008, 26.91732717, 26.92166257, 26.94424701, 26.92544985, 26.93126845, 26.94762778, 26.93291807, 26.92391253, 26.92561841, 26.91191459, 26.92017555, 26.93492889, 26.93982506, 26.928334 , 26.93380117, 26.92650318, 26.93528128, 26.93564916, 26.91931438, 26.90660572, 26.89851594, 26.88857388, 26.89678431, 26.89061284, 26.89896154, 26.88883901, 26.89992881, 26.88757634, 26.88044453, 26.866395 , 26.86993456, 26.85287619, 26.86647439, 26.86028552, 26.87216711, 26.85865474, 26.86756778, 26.88193583, 26.88239717, 26.8675251 , 26.8657918 , 26.87043333, 26.87349463, 26.86986876, 26.86918545, 26.87072372, 26.87181187, 26.85748363, 26.87248921, 26.84929347, 26.85918021, 26.86626601, 26.86309934, 26.86487222, 26.87550879, 26.87493443, 26.88973045, 26.87165761, 26.87428427, 26.87094736, 26.86520052, 26.86144876, 26.86337256, 26.88221669, 26.86957455, 26.88485765, 26.90645862, 26.8971405 , 26.89640117, 26.89833236, 26.88220835, 26.89092803, 26.89336276, 26.88980174, 26.88868308, 26.90476799, 26.89471698, 26.90876818, 26.90037894, 26.90170455, 26.90659738, 26.88817859, 26.90033221, 26.9105444 , 26.90626431, 26.88768864, 26.89279795, 26.90330768, 26.90312862, 26.8877306 , 26.90051031, 26.90408754, 26.88844085, 26.89492893, 26.89892101, 26.90213966, 26.88447475, 26.90207601, 26.8827889 , 26.8930347 , 26.88552713, 26.87882614, 26.87416339, 26.85973501, 26.8654778 , 26.87443995, 26.88552022, 26.87584591, 26.87767744, 26.89111829, 26.88497996, 26.87501717, 26.89783359, 26.897928 , 26.88530731, 26.90312266, 26.88795829, 26.889323 , 26.88871288, 26.87592268, 26.87634373, 26.88389516, 26.89520764, 26.89144468, 26.88291693, 26.88233399, 26.87621236, 26.86898899, 26.87669539, 26.86275339, 26.85845852, 26.8771708 , 26.8564992 , 26.87663937, 26.85945916, 26.85135436, 26.86178756, 26.87246585, 26.89331031, 26.88697147, 26.88126802, 26.86559176, 26.87530351, 26.8783741 , 26.85855937, 26.85534525, 26.85518265, 26.85166287, 26.86663461, 26.85076809, 26.8459866 , 26.83159089, 26.83833742, 26.83268523, 26.84286189, 26.85793495, 26.84266639, 26.86031771, 26.86174726, 26.85753012, 26.84772396, 26.86525822, 26.85119796, 26.8645227 , 26.86446619, 26.85808825, 26.85998631, 26.85435128, 26.84615111, 26.86439872, 26.84985256, 26.85941887, 26.85934615, 26.85470796, 26.84885645, 26.84690952, 26.85350013, 26.86057615, 26.86054683, 26.85815072, 26.84812045, 26.85288692, 26.85337043, 26.85408497, 26.84874821, 26.85120153, 26.8564229 , 26.85798168, 26.85971618, 26.85059714, 26.84926009, 26.86028767, 26.85686731, 26.86207199, 26.85770535, 26.85991001, 26.86753654, 26.86302161, 26.84748602, 26.85749149, 26.85466504, 26.84373736, 26.8614676 , 26.86280704, 26.86272049, 26.85873628, 26.849473 , 26.8477459 , 26.84487796, 26.85021567, 26.85070872, 26.85493374, 26.85554719, 26.85424972, 26.84630656, 26.8394587 , 26.83610892, 26.84204984, 26.85204291, 26.84631515, 26.83503079, 26.83773756, 26.84129763, 26.8496139 , 26.84110594, 26.84717989, 26.82747936, 26.84989786, 26.85893226, 26.84021163, 26.85161901, 26.85079074, 26.85234118, 26.86281466, 26.85487533, 26.85009694, 26.84954858, 26.85748172, 26.85790539, 26.86334562, 26.86286736, 26.86409736, 26.84827423, 26.86486006, 26.87619781, 26.88399148, 26.86937332, 26.86122942, 26.86671853, 26.85718894, 26.84942818, 26.85445738, 26.87249947, 26.86653447, 26.86326265, 26.86464405, 26.86552691, 26.86572504, 26.86627603, 26.8598609 , 26.85176134, 26.84443688, 26.84877896, 26.84902477, 26.85227656, 26.84074664, 26.86243582, 26.8542614 , 26.83991432, 26.84613872, 26.83709884, 26.83931971, 26.84317589, 26.84459305, 26.84247708, 26.84805393, 26.84041953, 26.85747576, 26.85140705, 26.84334898, 26.83019423, 26.83860278, 26.83924866, 26.84626102, 26.84985495, 26.84096813, 26.84401989, 26.8571949 , 26.85516953, 26.85183215, 26.84837937, 26.84352517, 26.85390067, 26.86730576, 26.87151718, 26.87192535, 26.86927128, 26.85424185, 26.8636055 , 26.85520411, 26.85064363, 26.84077454, 26.83921838, 26.830127 , 26.82058501, 26.81647325, 26.82347012, 26.81894207, 26.83583188, 26.85050726, 26.83958912, 26.82243562, 26.84736419, 26.85327291, 26.84489131, 26.85911202, 26.85299134, 26.83820534, 26.8460176 , 26.85913324, 26.83382893, 26.83786678, 26.85366106, 26.8372519 , 26.84178209, 26.84489274, 26.84657836, 26.86935401, 26.85574031, 26.84811378, 26.84698582, 26.83514905, 26.84755754, 26.85334349, 26.83937693, 26.83653569, 26.84465003, 26.83935642, 26.8405261 , 26.84504271, 26.84461713, 26.83962488, 26.84383965, 26.84744954, 26.86148286, 26.84509325, 26.84517002, 26.83987117, 26.84952188, 26.85889673, 26.85574913, 26.83951116, 26.85165358, 26.83894706, 26.84045267, 26.84239864, 26.82810116, 26.81926966, 26.81064105, 26.81260419, 26.8170526 , 26.8324914 , 26.81746173, 26.82841253, 26.81794047, 26.82559252, 26.82882905, 26.84269333, 26.84159398, 26.83063054, 26.821347 , 26.8426342 , 26.8322916 , 26.83358121, 26.83531928, 26.82592297, 26.82980919, 26.83302093, 26.83364868, 26.84207726, 26.83906651, 26.84719515, 26.86103559, 26.87151909, 26.85844469, 26.84465504, 26.85459018, 26.85536051, 26.84816885, 26.84275174, 26.86092186, 26.8518703 , 26.85025072, 26.86062193, 26.86043429, 26.84739423, 26.84250617, 26.84767413, 26.85028172, 26.84514475, 26.84561372, 26.86474299, 26.84317827, 26.82684159, 26.85283804, 26.85075331, 26.84161711, 26.83069921, 26.85461569, 26.8492589 , 26.8420651 , 26.8403604 , 26.85088611, 26.8381176 , 26.85197949, 26.86023951, 26.83570361, 26.83898973, 26.8326304 , 26.83964133, 26.83291435, 26.83927321, 26.84662771, 26.83139539, 26.82499146, 26.82268786, 26.83253098, 26.8309834 , 26.83298111, 26.81736922, 26.8323462 , 26.82991195, 26.8373549 , 26.837183 , 26.83651114, 26.84154677, 26.84007859, 26.83236623, 26.82904983, 26.83036304, 26.82910347, 26.8265202 , 26.83310485, 26.83182073, 26.83187318, 26.82815123, 26.81928706, 26.81817603, 26.80955529, 26.81500554, 26.8127408 , 26.82567215, 26.82299113, 26.82019973, 26.82912254, 26.82095289, 26.82089686, 26.82880235, 26.84402108, 26.83041787, 26.85408115, 26.85739756, 26.85322809, 26.85898066, 26.8683331 , 26.86026192, 26.83781219, 26.85920525, 26.85329485, 26.84316707, 26.85766315, 26.84535003, 26.84063387, 26.84955287, 26.85446 , 26.84384799, 26.85077047, 26.84603262, 26.84836769, 26.84114885, 26.84017277, 26.83386421, 26.83662343, 26.82988763, 26.82585406, 26.8366642 , 26.82176685, 26.82501578, 26.82829762, 26.82918835, 26.80586982, 26.82370925, 26.82763743, 26.84157634, 26.82744813, 26.83850193, 26.83558846, 26.83691502, 26.85349011, 26.86809039, 26.85851908, 26.855654 , 26.85236716, 26.85039258, 26.85198045, 26.83964729, 26.8326273 , 26.83573866, 26.83983326, 26.84575081, 26.85314512, 26.85625839, 26.85377312, 26.8513577 , 26.85300756, 26.85429978, 26.85316658, 26.85218525, 26.8409183 , 26.8474617 , 26.84005761, 26.8431468 , 26.84390426, 26.84545803, 26.87120581, 26.86381769, 26.86045337, 26.86600113, 26.85512352, 26.87143087, 26.85930824, 26.85429597, 26.85934997, 26.86953259, 26.85716319, 26.85268688, 26.85330939, 26.84858489, 26.85423279, 26.84389567, 26.85230637, 26.83668375, 26.85765982, 26.84148192, 26.81998038, 26.82656455, 26.83798528, 26.84594131, 26.83443451, 26.84062314, 26.83316064, 26.82052517, 26.82626867, 26.84171462, 26.8293674 , 26.83843303, 26.83717012, 26.84115958, 26.84359717, 26.84153032, 26.84265447, 26.84413528, 26.85161209, 26.84682727, 26.85235214, 26.86527705, 26.83956003, 26.85042024, 26.85714936, 26.85959363, 26.85696554, 26.85522699, 26.8560288 , 26.86611438, 26.86167526, 26.87048364, 26.87265182, 26.86827946, 26.86679173, 26.85084939, 26.85147238, 26.85617638, 26.84872723, 26.84212232, 26.82500458, 26.84187794, 26.82780766, 26.82776117, 26.82979298, 26.83671141, 26.83202291, 26.84532666, 26.84414721, 26.84710932, 26.85526657, 26.85392427, 26.86380672, 26.85640502, 26.8330915 , 26.84523726, 26.85365057, 26.84855175, 26.85855556, 26.84930491, 26.86730623, 26.86678457, 26.86522985, 26.8691473 , 26.86094332, 26.86843467, 26.85884404, 26.88045835, 26.86718678, 26.87704253, 26.86696172, 26.86722064, 26.8733182 , 26.86263514, 26.87270474, 26.86288285, 26.86054802, 26.86337304, 26.85060453, 26.85334921, 26.85946512, 26.85629153, 26.86761069, 26.85007691, 26.8522563 , 26.87450075, 26.86153078, 26.87275171, 26.85950208, 26.86378884, 26.86968851, 26.86369848, 26.86615181, 26.85400009, 26.85755634, 26.85486937, 26.85607147, 26.85288429, 26.84009886, 26.83464026, 26.82757354, 26.83669209, 26.83507109, 26.83722949, 26.84337139, 26.82981777, 26.83904123, 26.83783722, 26.84200358, 26.84828138, 26.83544731, 26.83496213, 26.82777476, 26.82560635, 26.81909537, 26.82418656, 26.81884027, 26.82783031, 26.83803129, 26.82002974, 26.81720996, 26.81968212, 26.83265138, 26.83606863, 26.82157421, 26.82759094, 26.82943177, 26.82041836, 26.81135583, 26.84091949, 26.84811354, 26.84167433, 26.82622218, 26.82084608, 26.82182097, 26.83150816, 26.82773495, 26.83036184, 26.82072473, 26.82362795, 26.83167195, 26.83287287, 26.82314157, 26.82881427, 26.82820129, 26.83258462, 26.83242774, 26.84465885, 26.8408947 , 26.84181118, 26.82303357, 26.82250977, 26.80981684, 26.83118224, 26.83948827, 26.83556581, 26.84120727, 26.8499639 , 26.83431196, 26.84088469, 26.82441425, 26.82977319, 26.8257277 , 26.83353567, 26.8153801 , 26.8256011 , 26.81381035, 26.80984664, 26.81667042, 26.82746172, 26.82815933, 26.81686187, 26.81556582, 26.82103872, 26.8224299 , 26.80953503, 26.80757189, 26.81046462, 26.80881643, 26.80789018, 26.81164074, 26.81948948, 26.82556129, 26.81841254, 26.82603765, 26.82541084, 26.81992483, 26.83591795, 26.83024788, 26.83610749, 26.81725764, 26.82152963, 26.81884098, 26.81355476, 26.82695675, 26.82940769, 26.82964683, 26.83190298, 26.83443284, 26.83247662, 26.83257508, 26.82528687, 26.82340074, 26.81798482, 26.81749249, 26.83267093, 26.82984638, 26.84835458, 26.84349656, 26.844172 , 26.85270834, 26.83754325, 26.84054947, 26.8490622 , 26.83615851, 26.842448 , 26.85289311, 26.84742284, 26.8300693 , 26.82435656, 26.82450271, 26.83420944, 26.83121371, 26.83002567, 26.8288343 , 26.84095693, 26.83169413, 26.85569787, 26.84172153, 26.84645557, 26.8559351 , 26.85131502, 26.8534379 , 26.8770082 , 26.87782955, 26.8795073 , 26.88947892, 26.88362551, 26.90169883, 26.87176538, 26.88371015, 26.89459467, 26.8918128 , 26.88805628, 26.88178778, 26.86861444, 26.87761307, 26.86785126, 26.87830448, 26.88716578, 26.87129283, 26.87902308, 26.88401151, 26.87543988, 26.86960769, 26.88606429, 26.88162422, 26.87718248, 26.88020635, 26.89028907, 26.88020897, 26.87645125, 26.86830401, 26.89530277, 26.87617588, 26.87344003, 26.87346935, 26.88965678, 26.86811233, 26.8736186 , 26.85744166, 26.85374498, 26.86964154, 26.87437773, 26.85597062, 26.85518265, 26.86182117, 26.8744638 , 26.87932467, 26.87967682, 26.87106037, 26.89176106, 26.89063811, 26.87904143, 26.90470552, 26.90308928, 26.90441203, 26.89915848, 26.90484738, 26.8916204 , 26.88932657, 26.89913797, 26.89764333, 26.89319301, 26.89674425, 26.89628172, 26.90237546, 26.90116715, 26.900805 , 26.8974328 , 26.91168475, 26.88935542, 26.88490486, 26.86805844, 26.88268566, 26.8904829 , 26.86572886, 26.87675834, 26.88141751, 26.88716483, 26.89149976, 26.88824725, 26.89859557, 26.89979029, 26.9044559 , 26.90799761, 26.90944934, 26.9057157 , 26.91304517, 26.89999843, 26.88695621, 26.88403869, 26.88069248, 26.87106705, 26.88765407, 26.88101649, 26.87659717, 26.88635731, 26.87634087, 26.87240458, 26.87424588, 26.88293862, 26.88800025, 26.87162066, 26.89127183, 26.89383173, 26.90290046, 26.91603208, 26.92384529, 26.94106793, 26.95424724]) gpu3 = np.array([25.11270475, 26.62109852, 26.81575751, 26.88658142, 26.88132572, 26.88771272, 26.87630844, 26.85903454, 26.84741282, 26.86420894, 26.84811282, 26.87003303, 26.86337972, 26.85856438, 26.84486508, 26.84059739, 26.83107543, 26.83580732, 26.8313992 , 26.83314204, 26.81876993, 26.8122673 , 26.81990242, 26.80419374, 26.80831599, 26.81325555, 26.80239582, 26.80638885, 26.79842877, 26.79606342, 26.79751778, 26.79554963, 26.78447104, 26.81415939, 26.80410266, 26.81967187, 26.80687094, 26.81885171, 26.79730177, 26.81420302, 26.79446912, 26.80408287, 26.78765082, 26.78674817, 26.77106547, 26.80053139, 26.80446124, 26.81883168, 26.81054091, 26.8101747 , 26.80241323, 26.79931784, 26.79531217, 26.78469825, 26.77456737, 26.77128172, 26.77434897, 26.76874876, 26.77149153, 26.76222372, 26.75309253, 26.76340723, 26.78179908, 26.7734704 , 26.79211879, 26.79349041, 26.77525806, 26.779953 , 26.78101397, 26.77840948, 26.7662046 , 26.78532147, 26.78070617, 26.77772188, 26.75712037, 26.76817179, 26.76994562, 26.7687192 , 26.77720475, 26.79444933, 26.79139853, 26.78774023, 26.7751689 , 26.78798079, 26.76168776, 26.76765585, 26.75024819, 26.76593828, 26.75136614, 26.77237725, 26.78172278, 26.79116035, 26.7650547 , 26.76160812, 26.75645041, 26.75182152, 26.75820494, 26.76488328, 26.75546861, 26.76041842, 26.76421928, 26.76286578, 26.74848652, 26.75775266, 26.75200844, 26.7406435 , 26.76303196, 26.76146388, 26.75558758, 26.75293589, 26.74844432, 26.75651121, 26.76574516, 26.76689124, 26.75955439, 26.76708961, 26.78924966, 26.76203752, 26.75313139, 26.75158143, 26.73674154, 26.76657486, 26.75672317, 26.75077391, 26.74925566, 26.76089334, 26.77749705, 26.77331972, 26.76603556, 26.77180576, 26.77416706, 26.77373672, 26.77110481, 26.75135326, 26.76164246, 26.73510885, 26.73400593, 26.75007296, 26.74547124, 26.73143077, 26.75717688, 26.75056648, 26.75838256, 26.75151038, 26.73012948, 26.71384311, 26.71659589, 26.72992349, 26.72547174, 26.72125673, 26.70886755, 26.70931435, 26.71027184, 26.69416499, 26.69133997, 26.694417 , 26.68369007, 26.68970871, 26.69907475, 26.68664193, 26.69241595, 26.70325685, 26.7010262 , 26.6910944 , 26.6801455 , 26.67417622, 26.67118478, 26.67912173, 26.6756022 , 26.67544532, 26.66820097, 26.68176103, 26.68002796, 26.68500471, 26.67192364, 26.69235516, 26.69576764, 26.66991854, 26.67351794, 26.66240573, 26.65155506, 26.64922142, 26.66619039, 26.66828775, 26.6700387 , 26.66566515, 26.68489647, 26.66988039, 26.64865541, 26.68733478, 26.67518115, 26.68762469, 26.6861515 , 26.67321634, 26.68783617, 26.68232226, 26.69658756, 26.69528508, 26.67897701, 26.6850934 , 26.66809058, 26.65783334, 26.64931679, 26.66270876, 26.67984438, 26.67268229, 26.6663239 , 26.66990542, 26.6798811 , 26.69616675, 26.68794847, 26.72285056, 26.71630812, 26.70520544, 26.69971538, 26.69137692, 26.6768198 , 26.68429208, 26.68122315, 26.68080974, 26.67544198, 26.68041706, 26.66684008, 26.66480732, 26.68467641, 26.68370891, 26.68830538, 26.67897606, 26.68432713, 26.67253327, 26.66654181, 26.67056942, 26.67879033, 26.66959476, 26.68001699, 26.67072606, 26.66623425, 26.67674541, 26.66278934, 26.67111087, 26.66473746, 26.67614198, 26.65465927, 26.65516996, 26.65523529, 26.64690804, 26.65014195, 26.6764493 , 26.67579722, 26.67532372, 26.6860714 , 26.68315744, 26.7001853 , 26.68957162, 26.70371175, 26.68837953, 26.69217896, 26.69133711, 26.69160676, 26.67438221, 26.66558981, 26.67983723, 26.67375302, 26.6663425 , 26.67590976, 26.66628289, 26.66335702, 26.65844035, 26.66673851, 26.65328789, 26.65643954, 26.66050649, 26.67472291, 26.65939641, 26.66659212, 26.6709094 , 26.67402458, 26.65701079, 26.67682886, 26.66441894, 26.66714048, 26.6499455 , 26.64858937, 26.66831136, 26.66096163, 26.66848326, 26.65349054, 26.65577197, 26.6524322 , 26.66367483, 26.65208507, 26.66506648, 26.65898919, 26.65629387, 26.6584816 , 26.67442799, 26.66078687, 26.66375446, 26.67015219, 26.67153907, 26.67101407, 26.66230798, 26.66124463, 26.6751492 , 26.68314695, 26.66704988, 26.67701173, 26.6950345 , 26.68380022, 26.68601227, 26.68751001, 26.67718101, 26.69758701, 26.71838975, 26.72582579, 26.72056746, 26.69184613, 26.68425179, 26.67946482, 26.67691827, 26.66651702, 26.66706181, 26.67644644, 26.67191815, 26.66004014, 26.67544651, 26.66960001, 26.65449381, 26.66837931, 26.67363381, 26.66858792, 26.68367243, 26.67763066, 26.68400645, 26.67293978, 26.66998005, 26.67463946, 26.67508984, 26.67882061, 26.68534899, 26.6767323 , 26.68402624, 26.68586636, 26.6853776 , 26.69837284, 26.68975043, 26.70067835, 26.71132779, 26.69962859, 26.69352007, 26.69781327, 26.6953578 , 26.68275738, 26.69327164, 26.68190789, 26.66630316, 26.66577911, 26.69061422, 26.67413616, 26.68186212, 26.70404673, 26.69683623, 26.68977165, 26.68486929, 26.67110968, 26.67565227, 26.68784618, 26.66836739, 26.67182422, 26.66860604, 26.68248296, 26.69832516, 26.70032525, 26.69375896, 26.69949841, 26.68837976, 26.68253779, 26.67850733, 26.68243551, 26.68058777, 26.68093109, 26.67648768, 26.67272449, 26.67868495, 26.6839509 , 26.68941855, 26.6987617 , 26.68345404, 26.67509699, 26.66701055, 26.67229438, 26.67401123, 26.68771791, 26.67603636, 26.6882453 , 26.67233014, 26.68529081, 26.67606592, 26.69619727, 26.68895841, 26.69597697, 26.69926333, 26.68724108, 26.6875515 , 26.67786312, 26.67959642, 26.68694663, 26.70372319, 26.69353175, 26.69560003, 26.69363523, 26.69256306, 26.68915701, 26.69562268, 26.68191957, 26.69383097, 26.69560528, 26.67454076, 26.67122531, 26.67390871, 26.67586112, 26.68636799, 26.68059182, 26.68993258, 26.67815471, 26.6936872 , 26.67954445, 26.69330812, 26.70102549, 26.69046187, 26.68329215, 26.69040275, 26.71801662, 26.70168519, 26.68641663, 26.69734693, 26.71217537, 26.7095902 , 26.70323372, 26.70842075, 26.71205163, 26.72647047, 26.7075386 , 26.70208812, 26.70391989, 26.7037003 , 26.70854282, 26.70094323, 26.71473813, 26.69308138, 26.6968708 , 26.70648742, 26.7064743 , 26.70307398, 26.70044565, 26.69540119, 26.69032979, 26.69141054, 26.68804073, 26.69362879, 26.68155622, 26.68738532, 26.68580055, 26.6861515 , 26.69524598, 26.69189978, 26.69538999, 26.68957639, 26.69846392, 26.70113468, 26.71402407, 26.6995194 , 26.70869637, 26.6859498 , 26.67822433, 26.68080401, 26.67787576, 26.66228771, 26.65620589, 26.64434719, 26.66112971, 26.6394186 , 26.65190721, 26.6619513 , 26.67098284, 26.6747973 , 26.68683553, 26.66805291, 26.6606226 , 26.66486287, 26.67145467, 26.65872097, 26.67541385, 26.65479255, 26.64241886, 26.66041422, 26.65491819, 26.66858149, 26.65725136, 26.65305066, 26.66328955, 26.65584731, 26.66025448, 26.64540792, 26.64400482, 26.64354634, 26.63735771, 26.6396594 , 26.64468789, 26.65125537, 26.6706481 , 26.66621852, 26.67009091, 26.66928887, 26.66588759, 26.66818547, 26.67338467, 26.67939949, 26.65670633, 26.64917111, 26.63944292, 26.65983868, 26.66087198, 26.6466012 , 26.66210365, 26.63553047, 26.65133548, 26.64084244, 26.64825487, 26.64683914, 26.64909959, 26.65308809, 26.65386415, 26.65587473, 26.64471769, 26.65723205, 26.65099049, 26.64877582, 26.66420674, 26.6563127 , 26.66798091, 26.64703202, 26.63738084, 26.64711475, 26.66684556, 26.6589396 , 26.67562532, 26.66654921, 26.66470551, 26.65139174, 26.65701318, 26.66443682, 26.66924047, 26.66597748, 26.67251945, 26.67858291, 26.70290518, 26.67219687, 26.66026115, 26.66915131, 26.65917587, 26.65794468, 26.66328382, 26.64540672, 26.65145397, 26.65026593, 26.65342474, 26.6495378 , 26.64737749, 26.65709448, 26.66985106, 26.66808057, 26.67863226, 26.68466306, 26.67908406, 26.68108606, 26.69004202, 26.67189693, 26.67388439, 26.67438436, 26.67443991, 26.68691444, 26.68330789, 26.67409468, 26.65806746, 26.65524602, 26.64647055, 26.68188882, 26.66605926, 26.66927314, 26.67549253, 26.66195178, 26.68059611, 26.68230176, 26.67958617, 26.69177175, 26.68512392, 26.66717291, 26.65886784, 26.66409683, 26.66860294, 26.67201591, 26.66080451, 26.67024851, 26.66393661, 26.65075731, 26.6534667 , 26.65578318, 26.66690946, 26.66077399, 26.65419054, 26.6304419 , 26.6563375 , 26.65736079, 26.66549015, 26.64424944, 26.66083813, 26.65030265, 26.64757228, 26.65442252, 26.66282463, 26.6467762 , 26.65558267, 26.64783978, 26.65843415, 26.64627695, 26.64627647, 26.6520915 , 26.65371013, 26.64303565, 26.64763665, 26.64892793, 26.63625026, 26.64119124, 26.63897109, 26.63264298, 26.6271069 , 26.65008998, 26.63700128, 26.62928843, 26.63881516, 26.63684773, 26.64954424, 26.64029336, 26.64227414, 26.64280629, 26.63951015, 26.65674782, 26.65079021, 26.65292287, 26.66477036, 26.65350986, 26.65466523, 26.6623683 , 26.67405367, 26.67596841, 26.67624044, 26.6901505 , 26.67381144, 26.68111348, 26.68453312, 26.67615747, 26.68409562, 26.67119575, 26.66460729, 26.66972923, 26.66127276, 26.67208385, 26.67553806, 26.65484929, 26.66820574, 26.67053723, 26.68171048, 26.68560362, 26.67488337, 26.68265843, 26.67702436, 26.66415143, 26.67312407, 26.66464734, 26.66770744, 26.68868089, 26.68140388, 26.66423488, 26.68473792, 26.67427468, 26.67078543, 26.65483499, 26.67842627, 26.66261625, 26.68266225, 26.67631888, 26.67542624, 26.67487383, 26.6636281 , 26.64776444, 26.66335464, 26.65488267, 26.65151024, 26.65965581, 26.65036535, 26.64996982, 26.65853548, 26.66486216, 26.67581654, 26.67540455, 26.65177655, 26.65058088, 26.64256406, 26.66038871, 26.66241765, 26.65997624, 26.64688134, 26.6497488 , 26.67167974, 26.67045379, 26.66518927, 26.66224051, 26.65645695, 26.65947247, 26.65502787, 26.66109395, 26.65467596, 26.67137337, 26.65287304, 26.65602946, 26.65760684, 26.64639878, 26.64318275, 26.67336226, 26.65836811, 26.65514374, 26.6477592 , 26.64002299, 26.64459634, 26.65169692, 26.64682078, 26.64431214, 26.63535929, 26.65622878, 26.65691042, 26.65337753, 26.66769123, 26.65122795, 26.64902854, 26.64542055, 26.65679169, 26.65068865, 26.64966846, 26.66705775, 26.68883514, 26.65456629, 26.66443539, 26.65122747, 26.6402483 , 26.6392765 , 26.66086721, 26.66120505, 26.65163803, 26.65038037, 26.63942099, 26.64315653, 26.66104579, 26.64021754, 26.64219952, 26.66298676, 26.64372897, 26.65061355, 26.64835572, 26.64347267, 26.64203382, 26.6364069 , 26.63920522, 26.63499236, 26.65613365, 26.6634593 , 26.64344621, 26.64402175, 26.66027331, 26.64893365, 26.64568496, 26.65806127, 26.6568687 , 26.65582824, 26.66059566, 26.64895296, 26.65358019, 26.65165544, 26.65841937, 26.64774966, 26.65334678, 26.64754534, 26.63985014, 26.66243553, 26.65594959, 26.63085079, 26.65820527, 26.654387 , 26.64405441, 26.64177585, 26.6523757 , 26.63924098, 26.6486733 , 26.64455271, 26.65134311, 26.66027856, 26.65699291, 26.65425706, 26.662884 , 26.6605835 , 26.66696095, 26.66734052, 26.68712473, 26.6545577 , 26.65918422, 26.65231562, 26.6460638 , 26.6644249 , 26.68378043, 26.67245913, 26.66943908, 26.66193461, 26.67995906, 26.6651237 , 26.65360713, 26.66667199, 26.6721313 , 26.66256618, 26.68000221, 26.67219901, 26.6625545 , 26.65266633, 26.6758647 , 26.66842198, 26.68164611, 26.67982125, 26.69271636, 26.69598269, 26.70067644, 26.69938946, 26.68466234, 26.68293166, 26.67652702, 26.66345978, 26.66896772, 26.68276453, 26.68550563, 26.68022871, 26.67868114, 26.68580151, 26.68801427, 26.67497301, 26.69194841, 26.70005798, 26.70016432, 26.69350529, 26.69847465, 26.69466615, 26.68378973, 26.68674183, 26.70399165, 26.69341326, 26.68247652, 26.67382431, 26.67532945, 26.67981505, 26.67861414, 26.68116927, 26.6856761 , 26.6742754 , 26.68393159, 26.69408703, 26.68737626, 26.69434595, 26.69844151, 26.70571208, 26.7132659 , 26.69396734, 26.69022608, 26.71233344, 26.71293521, 26.69544578, 26.69676089, 26.68031645, 26.68379545, 26.68534899, 26.67085361, 26.67457557, 26.65981054, 26.68254018, 26.67135596, 26.66392732, 26.66836071, 26.6377387 , 26.66200089, 26.65002894, 26.65066218, 26.67185044, 26.66454577, 26.66642952, 26.6439693 , 26.65373254, 26.66803026, 26.66402602, 26.66372275, 26.64594817, 26.65445757, 26.65516639, 26.65467429, 26.64455581, 26.6334753 , 26.63134217, 26.63031459, 26.62299085, 26.61836696, 26.6142199 , 26.62253904, 26.62660313, 26.62524843, 26.62713432, 26.6088028 , 26.62113237, 26.60325146, 26.60930324, 26.61416245, 26.61139321, 26.60938525, 26.61235452, 26.59928322, 26.60898948, 26.60763288, 26.59756589, 26.60873079, 26.60318494, 26.5947926 , 26.6014514 , 26.60260534, 26.61568427, 26.59612441, 26.59719849, 26.60061646, 26.61212564, 26.61309433, 26.60126877, 26.61778522, 26.61926603, 26.63306999, 26.60862398, 26.60968328, 26.61920047, 26.62087011, 26.61579514, 26.62294364, 26.61832047, 26.60259032, 26.6181643 , 26.62093997, 26.61793065, 26.61678386, 26.62405491, 26.62495327, 26.61143208, 26.61613083, 26.61345172, 26.60783887, 26.60655165, 26.6182642 , 26.60799766, 26.61139345, 26.60771894, 26.59899855, 26.6086812 , 26.60607672, 26.6043613 , 26.64232302, 26.62122774, 26.63283992, 26.63506126, 26.63869143, 26.63893318, 26.64299583, 26.6442709 , 26.64890242, 26.64481497, 26.6418612 , 26.64379334, 26.63482141, 26.62822437, 26.62470961, 26.62942839, 26.63780546, 26.62608695, 26.61770988, 26.62022519, 26.62184 , 26.61017394, 26.60902023, 26.6099267 , 26.60373521, 26.62620401])
// Definition of the Node class for the linked list class Node<T> { var value: T var next: Node? init(value: T) { self.value = value } } // Implementation of the Stack data structure class Stack<T> { private var top: Node<T>? func push(_ value: T) { let newNode = Node(value: value) newNode.next = top top = newNode } func pop() -> T? { let poppedValue = top?.value top = top?.next return poppedValue } var reversed: Stack<T> { let reversedStack = Stack<T>() var current = top while let node = current { reversedStack.push(node.value) current = node.next } return reversedStack } } // Example usage var stack = Stack<Int>() stack.push(1) stack.push(2) stack.push(3) print(stack.pop()) // Output: 3 print(stack.reversed.pop()) // Output: 1
import PropTypes from "prop-types" import React from "react" import { Link } from "gatsby" const SiteHeader = ({ lightVersion }) => ( <nav className={lightVersion ? 'c-site-header c-site-header--light' : 'c-site-header'}> <div className="o-page-layout c-site-header__inner"> <Link to="/" className="c-site-header__logo" > <svg className="c-site-header__logo-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 52 47.87"> <path style={{fill: `var(--c-logo-color, white`}} d="M4.45 47.85H0l17.2-39.2h4.46l-17.2 39.2z"/> <path style={{fill: `var(--c-logo-color, white`}} d="M34.1 32.68A17.05 17.05 0 0147.8 1.45L46.18 5.2a13 13 0 00-10.42 23.74z"/> <path style={{fill: `var(--c-logo-color, white`}} d="M52 30.82a17 17 0 01-32.54 7.1H13.3l1.78-4.08h7.2l.48 1.36a13 13 0 1017.42-16.24l1.64-3.75A17.07 17.07 0 0152 30.83z"/> </svg> <span className="c-site-header__logo-name"><NAME></span> </Link> </div> </nav> ) SiteHeader.propTypes = { lightVersion: PropTypes.bool, } SiteHeader.defaultProps = { lightVersion: false, } export default SiteHeader
package com.huatuo.interfaces; public interface IHandler { public void doHandler(); }
#!/usr/bin/env bash ################################################################################ # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ################################################################################ set -Eeuo pipefail KAFKA_VERSION="2.8.1" CONFLUENT_VERSION="6.2.2" CONFLUENT_MAJOR_VERSION="6.2" # Check the Confluent Platform <> Apache Kafka compatibility matrix when updating KAFKA_VERSION KAFKA_SQL_VERSION="universal" ELASTICSEARCH_VERSION=7 # we use the smallest version possible ELASTICSEARCH_MAC_DOWNLOAD_URL='https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.15.2-darwin-x86_64.tar.gz' ELASTICSEARCH_LINUX_DOWNLOAD_URL='https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.15.2-linux-x86_64.tar.gz' source "$(dirname "$0")"/common.sh source "$(dirname "$0")"/kafka_sql_common.sh \ $KAFKA_VERSION \ $CONFLUENT_VERSION \ $CONFLUENT_MAJOR_VERSION \ $KAFKA_SQL_VERSION source "$(dirname "$0")"/elasticsearch-common.sh SQL_TOOLBOX_JAR=$END_TO_END_DIR/flink-sql-client-test/target/SqlToolbox.jar SQL_JARS_DIR=$END_TO_END_DIR/flink-sql-client-test/target/sql-jars ################################################################################ # Verify existing SQL jars ################################################################################ EXTRACTED_JAR=$TEST_DATA_DIR/extracted mkdir -p $EXTRACTED_JAR for SQL_JAR in $SQL_JARS_DIR/*.jar; do echo "Checking SQL JAR: $SQL_JAR" (cd $EXTRACTED_JAR && jar xf $SQL_JAR) # check for proper shading for EXTRACTED_FILE in $(find $EXTRACTED_JAR -type f); do if ! [[ $EXTRACTED_FILE = "$EXTRACTED_JAR/org/apache/flink"* ]] && \ ! [[ $EXTRACTED_FILE = "$EXTRACTED_JAR/META-INF"* ]] && \ ! [[ $EXTRACTED_FILE = "$EXTRACTED_JAR/LICENSE"* ]] && \ ! [[ $EXTRACTED_FILE = "$EXTRACTED_JAR/NOTICE"* ]] && \ ! [[ $EXTRACTED_FILE = "$EXTRACTED_JAR/org/apache/avro"* ]] && \ # Following required by amazon-kinesis-producer in flink-connector-kinesis ! [[ $EXTRACTED_FILE = "$EXTRACTED_JAR/amazon-kinesis-producer-native-binaries"* ]] && \ ! [[ $EXTRACTED_FILE = "$EXTRACTED_JAR/cacerts"* ]] && \ ! [[ $EXTRACTED_FILE = "$EXTRACTED_JAR/google"* ]] ; then echo "Bad file in JAR: $EXTRACTED_FILE" exit 1 fi done # check for table factory if [ ! -f $EXTRACTED_JAR/META-INF/services/org.apache.flink.table.factories.Factory ]; then echo "No table factory found in JAR: $SQL_JAR" exit 1 fi # clean up rm -r $EXTRACTED_JAR/* done rm -r $EXTRACTED_JAR ################################################################################ # Prepare connectors ################################################################################ ELASTICSEARCH_INDEX='my_users' function sql_cleanup() { stop_kafka_cluster shutdown_elasticsearch_cluster "$ELASTICSEARCH_INDEX" } on_exit sql_cleanup function prepare_elasticsearch { echo "Preparing Elasticsearch (version=$ELASTICSEARCH_VERSION)..." # elastcisearch offers different release binary file for corresponding system since version 7. case "$(uname -s)" in Linux*) OS_TYPE=linux;; Darwin*) OS_TYPE=mac;; *) OS_TYPE="UNKNOWN:${unameOut}" esac if [[ "$OS_TYPE" == "mac" ]]; then DOWNLOAD_URL=$ELASTICSEARCH_MAC_DOWNLOAD_URL elif [[ "$OS_TYPE" == "linux" ]]; then DOWNLOAD_URL=$ELASTICSEARCH_LINUX_DOWNLOAD_URL else echo "[ERROR] Unsupported OS for Elasticsearch: $OS_TYPE" exit 1 fi setup_elasticsearch $DOWNLOAD_URL $ELASTICSEARCH_VERSION wait_elasticsearch_working } # prepare Kafka echo "Preparing Kafka..." setup_kafka_dist start_kafka_cluster create_kafka_json_source test-json create_kafka_topic 1 1 test-avro # prepare Elasticsearch prepare_elasticsearch ################################################################################ # Prepare Flink ################################################################################ echo "Preparing Flink..." start_cluster start_taskmanagers 2 ################################################################################ # Run SQL statements ################################################################################ echo "Testing SQL statements..." KAFKA_SQL_JAR=$(find "$SQL_JARS_DIR" | grep "kafka" ) ELASTICSEARCH_SQL_JAR=$(find "$SQL_JARS_DIR" | grep "elasticsearch$ELASTICSEARCH_VERSION" ) # create session environment file RESULT=$TEST_DATA_DIR/result INIT_SQL=$TEST_DATA_DIR/sql-client-init.sql get_kafka_json_source_schema test-json JsonSourceTable >> $INIT_SQL cat >> $INIT_SQL << EOF CREATE TABLE ElasticsearchUpsertSinkTable ( user_id INT, user_name STRING, user_count BIGINT, PRIMARY KEY (user_id) NOT ENFORCED ) WITH ( 'connector' = 'elasticsearch-$ELASTICSEARCH_VERSION', 'hosts' = 'http://localhost:9200', 'index' = '$ELASTICSEARCH_INDEX', 'sink.bulk-flush.max-actions' = '1', 'format' = 'json' ); CREATE TABLE ElasticsearchAppendSinkTable ( user_id INT, user_name STRING, user_count BIGINT ) WITH ( 'connector' = 'elasticsearch-$ELASTICSEARCH_VERSION', 'hosts' = 'http://localhost:9200', 'index' = '$ELASTICSEARCH_INDEX', 'sink.bulk-flush.max-actions' = '1', 'format' = 'json' ); CREATE FUNCTION RegReplace AS 'org.apache.flink.table.toolbox.StringRegexReplaceFunction'; EOF # submit SQL statements echo "Executing SQL: Values -> Elasticsearch (upsert)" SQL_STATEMENT_1=$(cat << EOF INSERT INTO ElasticsearchUpsertSinkTable SELECT user_id, user_name, COUNT(*) AS user_count FROM (VALUES (1, 'Bob'), (22, 'Tom'), (42, 'Kim'), (42, 'Kim'), (42, 'Kim'), (1, 'Bob')) AS UserCountTable(user_id, user_name) GROUP BY user_id, user_name EOF ) JOB_ID=$($FLINK_DIR/bin/sql-client.sh \ --jar $KAFKA_SQL_JAR \ --jar $ELASTICSEARCH_SQL_JAR \ --jar $SQL_TOOLBOX_JAR \ --init $INIT_SQL \ --update "$SQL_STATEMENT_1" | grep "Job ID:" | sed 's/.* //g') wait_job_terminal_state "$JOB_ID" "FINISHED" verify_result_line_number 3 "$ELASTICSEARCH_INDEX" echo "Executing SQL: Values -> Elasticsearch (append, no key)" SQL_STATEMENT_2=$(cat << EOF INSERT INTO ElasticsearchAppendSinkTable SELECT * FROM ( VALUES (1, 'Bob', CAST(0 AS BIGINT)), (22, 'Tom', CAST(0 AS BIGINT)), (42, 'Kim', CAST(0 AS BIGINT)), (42, 'Kim', CAST(0 AS BIGINT)), (42, 'Kim', CAST(0 AS BIGINT)), (1, 'Bob', CAST(0 AS BIGINT))) AS UserCountTable(user_id, user_name, user_count) EOF ) JOB_ID=$($FLINK_DIR/bin/sql-client.sh \ --jar $KAFKA_SQL_JAR \ --jar $ELASTICSEARCH_SQL_JAR \ --jar $SQL_TOOLBOX_JAR \ --init $INIT_SQL \ --update "$SQL_STATEMENT_2" | grep "Job ID:" | sed 's/.* //g') wait_job_terminal_state "$JOB_ID" "FINISHED" # 3 upsert results and 6 append results verify_result_line_number 9 "$ELASTICSEARCH_INDEX" echo "Executing SQL: Match recognize -> Elasticsearch" SQL_STATEMENT_3=$(cat << EOF INSERT INTO ElasticsearchAppendSinkTable SELECT 1 as user_id, T.userName as user_name, cast(1 as BIGINT) as user_count FROM ( SELECT \`user\`, \`rowtime\` FROM JsonSourceTable WHERE \`user\` IS NOT NULL) MATCH_RECOGNIZE ( ORDER BY rowtime MEASURES \`user\` as userName PATTERN (A) DEFINE A as \`user\` = 'Alice' ) T EOF ) JOB_ID=$($FLINK_DIR/bin/sql-client.sh \ --jar $KAFKA_SQL_JAR \ --jar $ELASTICSEARCH_SQL_JAR \ --jar $SQL_TOOLBOX_JAR \ --init $INIT_SQL \ --update "$SQL_STATEMENT_3" | grep "Job ID:" | sed 's/.* //g') # 3 upsert results and 6 append results and 3 match_recognize results verify_result_line_number 12 "$ELASTICSEARCH_INDEX"
// Analytics.js import React, { Component } from 'react'; import { View, Text, Button, Image } from 'react-native'; import { LinearGradient } from 'expo-linear-gradient'; import { AntDesign, Feather, MaterialCommunityIcons, FontAwesome, Ionicons } from '@expo/vector-icons'; import InputScrollView from 'react-native-input-scroll-view'; import styles from '../Styles'; import Dock from '../components/Dock'; import firebase from 'firebase'; var config = { apiKey: "<KEY>", authDomain: "ducky-ml.firebaseapp.com", databaseURL: "https://ducky-ml.firebaseio.com", projectId: "ducky-ml", storageBucket: "ducky-ml.appspot.com", messagingSenderId: "1096270328273" }; var name; var daysOnDucky; var numJournalEntries; if (!firebase.apps.length){ firebase.initializeApp(config); } var database = firebase.database(); database.ref('/users/haylee/acctInfo/recent/daysOnDucky').once('value', function(snapshot){ daysOnDucky = snapshot.val() }); database.ref('/users/haylee/acctInfo/recent/daysOnJournal').once('value', function(snapshot){ console.log(snapshot.val()); numJournalEntries = snapshot.val() }); database.ref('/users/haylee/acctInfo/recent/Name').once('value', function(snapshot){ console.log(snapshot.val()); name = snapshot.val() }); export class Analytics extends Component { constructor() { super(); this.state = { month: '', year: '', } } componentDidMount() { var month = new Date().getMonth() + 1; var year = new Date().getFullYear(); var fullMonth; switch (month) { case 1: fullMonth = 'January'; break; case 2: fullMonth = 'February'; break; case 3: fullMonth = 'March'; break; case 4: fullMonth = 'April'; break; case 5: fullMonth = 'May'; break; case 6: fullMonth = 'June'; break; case 7: fullMonth = 'July'; break; case 8: fullMonth = 'August'; break; case 9: fullMonth = 'September'; break; case 10: fullMonth = 'October'; break; case 11: fullMonth = 'November'; break; case 12: fullMonth = 'December'; break; default: fullMonth = 'Error'; } this.setState({month: fullMonth}); this.setState({year: year}); } render() { database.ref('/users/haylee/acctInfo/recent/Name').once('value', function(snapshot){ console.log(snapshot.val()); name = snapshot.val() }); return ( <LinearGradient style={styles.container} colors={['#6B8DB2', '#7998B9']}> <InputScrollView> {/* Top text */} <View style={{paddingLeft: 30, paddingRight: 30}}> <View> <Text style={styles.white_45}>Hi,</Text> <Text> <Text style={styles.yellow_45}>{name}</Text> <Text style={styles.white_45}>!</Text> </Text> </View> <View style={{paddingTop: 30}}> <Text style={styles.white_15}>Welcome to your personal analytics page.</Text> <Text style={styles.white_15}>Check in to see all the progress you've made and how your emotions have fluctuated over time!</Text> </View> </View> {/* Month and Year */} <View style={{flexDirection: 'row', alignItems: 'center', justifyContent: 'center', paddingTop: 30}}> <View style={{paddingRight: 30}}> <Ionicons name="ios-arrow-back" size={25} color="#fbfbfb" /> </View> <Text style={{fontSize: 25, color: '#ffffff', fontWeight: 'bold'}}> <Text style={{paddingRight: 20}}>{this.state.month} </Text> <Text>{this.state.year}</Text> </Text> <View style={{paddingLeft: 30}}> <Ionicons name="ios-arrow-forward" size={25} color="#fbfbfb" /> </View> </View> {/* Cards */} <View style={{alignItems: 'center', justifyContent: 'center', paddingTop: 30, }}> {/* Habit Tracker */} {/* <View style={styles.analytics_card}> <Text style={styles.blue_25}>Habit Tracker</Text> </View> */} {/* Emotion Map */} <View style={styles.analytics_card}> <Text style={styles.blue_25}>Emotion Map</Text> <Image style={{width: 350, height: 200}} source = {require('../../assets/Chart.png')}></Image> </View> {/* Top Habits */} {/* <View style={styles.analytics_card}> <Text style={styles.blue_25}>Top Habits</Text> </View> */} {/* Your Best Memory */} {/* <View style={styles.analytics_card}> <Text style={styles.blue_25}>Your Best Memory</Text> </View> */} {/* Stats */} <View style={{flexDirection: 'row', paddingLeft: 30, paddingRight: 30, alignContent: 'center', }}> <View style={styles.analytics_halfcard}> <Text style={styles.yellow_75}>{daysOnDucky}</Text> <Text style={{color: '#f9e067', fontSize: 20, fontStyle: 'italic'}}>days on Ducky</Text> </View> <View style={styles.analytics_halfcard}> <Text style={styles.yellow_75}>{numJournalEntries}</Text> <Text style={{color: '#f9e067', fontSize: 20, fontStyle: 'italic'}}>journal entries</Text> </View> </View> {/* Bottom Affirmation */} <View style={{alignContent: 'center', justifyContent: 'center', paddingTop: 30}}> <Text style={{color: '#fbfbfb', fontSize: 15, fontStyle: 'italic'}}>Keep going, you're doing great! :-)</Text> </View> <View style={{paddingBottom: 150}}></View> </View> </InputScrollView> {/* Dock - isn't locked properly yet*/} <Dock navigation={this.props.navigation}/> </LinearGradient> ) } } export default Analytics;
#!/bin/bash fileid="1Gvn_DvlozKE-XQLGhEsNIRd1h-dhhxC-" html=`curl -c ./cookie -s -L "https://drive.google.com/uc?export=download&id=${fileid}"` curl -Lb ./cookie "https://drive.google.com/uc?export=download&`echo ${html}|grep -Po '(confirm=[a-zA-Z0-9\-_]+)'`&id=${fileid}" -o resources.tar.gz tar -zxvf resources.tar.gz rm resources.tar.gz echo Download finished.
#!/usr/bin/env python import urllib2 response = urllib2.urlopen('http://localhost:8080/') print'RESPONSE: ',response print'URL: ',response.geturl() headers = response.info() print'DATE: ',headers['date'] print'HEADERS :' print'---------------' print headers data = response.read() print'LENGTH :',len(data) print'DATA :' print'-------------' print data
import styled from "styled-components" const Nav = styled.nav` position: fixed; width: 100%; z-index: 1; background-color: #2c74d2; color: #fff; ${props => props.theme.contentPadding}; padding-top: 24px; padding-bottom: 24px; justify-content: space-between; display: flex; flex-direction: row; align-items: center; h1 { font-size: 20px; color: #fff; } ul { display: flex; list-style-type: none; li { margin-left: 16px; a { text-decoration: none; color: ${props => props.theme.colors.text.contrast}; } } } ` export default Nav
#!/bin/sh $HADOOP_EXECUTABLE fs ${RMR} $OUTPUT_CC run_benchmark "$HADOOP_EXECUTABLE jar ${PEGASUS_JAR} pegasus.ConCmpt \ ${INPUT_CC}/edges ${OUTPUT_CC} \ ${CC_PAGES} ${REDUCERS_NUMBER} ${CC_MAX_ITERATIONS} nosym new" if [ $(cat $TMPLOGFILE | grep -i -E 'job failed|FinalApplicationStatus=FAILED|Exception in thread "main"' | wc -l) != "0" ] then ELAPSED_TIME="FAILED" fi
<gh_stars>1-10 // Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. #include "pal_zlib.h" #include "pal_utilities.h" #include <assert.h> #include <zlib.h> static_assert(PAL_Z_NOFLUSH == Z_NO_FLUSH, ""); static_assert(PAL_Z_FINISH == Z_FINISH, ""); static_assert(PAL_Z_OK == Z_OK, ""); static_assert(PAL_Z_STREAMEND == Z_STREAM_END, ""); static_assert(PAL_Z_STREAMERROR == Z_STREAM_ERROR, ""); static_assert(PAL_Z_DATAERROR == Z_DATA_ERROR, ""); static_assert(PAL_Z_MEMERROR == Z_MEM_ERROR, ""); static_assert(PAL_Z_BUFERROR == Z_BUF_ERROR, ""); static_assert(PAL_Z_VERSIONERROR == Z_VERSION_ERROR, ""); static_assert(PAL_Z_NOCOMPRESSION == Z_NO_COMPRESSION, ""); static_assert(PAL_Z_BESTSPEED == Z_BEST_SPEED, ""); static_assert(PAL_Z_BESTCOMPRESSION == Z_BEST_COMPRESSION, ""); static_assert(PAL_Z_DEFAULTSTRATEGY == Z_DEFAULT_STRATEGY, ""); static_assert(PAL_Z_DEFLATED == Z_DEFLATED, ""); /* Initializes the PAL_ZStream by creating and setting its underlying z_stream. */ static void Init(PAL_ZStream* stream) { z_stream* zStream = new z_stream(); zStream->zalloc = Z_NULL; zStream->zfree = Z_NULL; zStream->opaque = Z_NULL; stream->internalState = zStream; } /* Frees any memory on the PAL_ZStream that was created by Init. */ static void End(PAL_ZStream* stream) { z_stream* zStream = reinterpret_cast<z_stream*>(stream->internalState); assert(zStream != nullptr); delete zStream; stream->internalState = nullptr; } /* Transfers the output values from the underlying z_stream to the PAL_ZStream. */ static void TransferState(z_stream* from, PAL_ZStream* to) { to->nextIn = from->next_in; to->availIn = from->avail_in; to->nextOut = from->next_out; to->availOut = from->avail_out; to->msg = from->msg; } /* Transfers the input values from the PAL_ZStream to the underlying z_stream object. */ static void TransferState(PAL_ZStream* from, z_stream* to) { to->next_in = from->nextIn; to->avail_in = from->availIn; to->next_out = from->nextOut; to->avail_out = from->availOut; } /* Gets the current z_stream object for the specified PAL_ZStream. This ensures any inputs are transferred from the PAL_ZStream to the underlying z_stream, since the current values are always needed. */ static z_stream* GetCurrentZStream(PAL_ZStream* stream) { z_stream* zStream = reinterpret_cast<z_stream*>(stream->internalState); assert(zStream != nullptr); TransferState(stream, zStream); return zStream; } // TODO: temporarily keeping the un-prefixed signature of this method // to keep tests running in CI. This will be removed once the managed assemblies // are synced up with the native assemblies. extern "C" int32_t DeflateInit2_(PAL_ZStream* stream, int32_t level, int32_t method, int32_t windowBits, int32_t memLevel, int32_t strategy) { return CompressionNative_DeflateInit2_(stream, level, method, windowBits, memLevel, strategy); } extern "C" int32_t CompressionNative_DeflateInit2_( PAL_ZStream* stream, int32_t level, int32_t method, int32_t windowBits, int32_t memLevel, int32_t strategy) { assert(stream != nullptr); Init(stream); z_stream* zStream = GetCurrentZStream(stream); int32_t result = deflateInit2(zStream, level, method, windowBits, memLevel, strategy); TransferState(zStream, stream); return result; } // TODO: temporarily keeping the un-prefixed signature of this method // to keep tests running in CI. This will be removed once the managed assemblies // are synced up with the native assemblies. extern "C" int32_t Deflate(PAL_ZStream* stream, int32_t flush) { return CompressionNative_Deflate(stream, flush); } extern "C" int32_t CompressionNative_Deflate(PAL_ZStream* stream, int32_t flush) { assert(stream != nullptr); z_stream* zStream = GetCurrentZStream(stream); int32_t result = deflate(zStream, flush); TransferState(zStream, stream); return result; } // TODO: temporarily keeping the un-prefixed signature of this method // to keep tests running in CI. This will be removed once the managed assemblies // are synced up with the native assemblies. extern "C" int32_t DeflateEnd(PAL_ZStream* stream) { return CompressionNative_DeflateEnd(stream); } extern "C" int32_t CompressionNative_DeflateEnd(PAL_ZStream* stream) { assert(stream != nullptr); z_stream* zStream = GetCurrentZStream(stream); int32_t result = deflateEnd(zStream); End(stream); return result; } // TODO: temporarily keeping the un-prefixed signature of this method // to keep tests running in CI. This will be removed once the managed assemblies // are synced up with the native assemblies. extern "C" int32_t InflateInit2_(PAL_ZStream* stream, int32_t windowBits) { return CompressionNative_InflateInit2_(stream, windowBits); } extern "C" int32_t CompressionNative_InflateInit2_(PAL_ZStream* stream, int32_t windowBits) { assert(stream != nullptr); Init(stream); z_stream* zStream = GetCurrentZStream(stream); int32_t result = inflateInit2(zStream, windowBits); TransferState(zStream, stream); return result; } // TODO: temporarily keeping the un-prefixed signature of this method // to keep tests running in CI. This will be removed once the managed assemblies // are synced up with the native assemblies. extern "C" int32_t Inflate(PAL_ZStream* stream, int32_t flush) { return CompressionNative_Inflate(stream, flush); } extern "C" int32_t CompressionNative_Inflate(PAL_ZStream* stream, int32_t flush) { assert(stream != nullptr); z_stream* zStream = GetCurrentZStream(stream); int32_t result = inflate(zStream, flush); TransferState(zStream, stream); return result; } // TODO: temporarily keeping the un-prefixed signature of this method // to keep tests running in CI. This will be removed once the managed assemblies // are synced up with the native assemblies. extern "C" int32_t InflateEnd(PAL_ZStream* stream) { return CompressionNative_InflateEnd(stream); } extern "C" int32_t CompressionNative_InflateEnd(PAL_ZStream* stream) { assert(stream != nullptr); z_stream* zStream = GetCurrentZStream(stream); int32_t result = inflateEnd(zStream); End(stream); return result; } // TODO: temporarily keeping the un-prefixed signature of this method // to keep tests running in CI. This will be removed once the managed assemblies // are synced up with the native assemblies. extern "C" uint32_t Crc32(uint32_t crc, uint8_t* buffer, int32_t len) { return CompressionNative_Crc32(crc, buffer, len); } extern "C" uint32_t CompressionNative_Crc32(uint32_t crc, uint8_t* buffer, int32_t len) { assert(buffer != nullptr); unsigned long result = crc32(crc, buffer, UnsignedCast(len)); assert(result <= UINT32_MAX); return static_cast<uint32_t>(result); }
import random from '@tsdotnet/random'; import {assert} from 'chai'; import ClockTime from '../src/ClockTime'; import {milliseconds} from '../src/howMany'; const days = random.integer(364) + 1, hour = random.integer(24), minute = random.integer(60), second = random.integer(60), millisecond = random.integer(1000); const c1 = new ClockTime(hour, minute, second, millisecond); const c2 = new ClockTime( days*milliseconds.per.day + hour*milliseconds.per.hour + minute*milliseconds.per.minute + second*milliseconds.per.second + millisecond); describe('.', () => { it('should match constructor values', () => { assert.equal(c1.hour, hour); assert.equal(c1.minute, minute); assert.equal(c1.second, second); assert.equal(c1.millisecond, millisecond); }); it('should match summed values', () => { assert.equal(c2.day, days); assert.equal(c2.hour, hour); assert.equal(c2.minute, minute); assert.equal(c2.second, second); assert.equal(c2.millisecond, millisecond); }); }); describe('.equals', () => { it('should not be equal', () => { assert.ok(!c1.equals(c2)); }); it('c1 should be less than c2', () => { assert.ok(c1.compareTo(c2)<0); }); });
import RPi.GPIO as GPIO import time # Set up GPIO GPIO.setmode(GPIO.BOARD) GPIO.setup(5, GPIO.OUT) GPIO.setup(3, GPIO.OUT) # Define the functions def fanh(): GPIO.output(5, GPIO.HIGH) def lightl(): GPIO.output(3, GPIO.LOW) def lighth(): GPIO.output(3, GPIO.HIGH) # Call the functions in the correct sequence fanh() # Turn the fan on time.sleep(1) # Wait for 1 second lightl() # Turn the light off time.sleep(1) # Wait for 1 second lighth() # Turn the light on # Clean up GPIO GPIO.cleanup()
# Benchmark Experiment: BCL-BERT on EE doc data, dropping docs without annotations (the adapted Mayhew 19 code) RUN_JUPYTER=false RUN_TENSORBOARD=false DATASET_LABEL=ee-short METHOD_LABEL=bcl-bert TRAIN_SUFFIX=_P-1000 # # Conll english # # tacl-eer_eng-c_ee-short_bcl-bert # bash scripts/run_remote_mayhew19_experiment.sh\ # PUBLIC_IP=3.92.96.173\ # PRIVATE_IP=172.31.50.192\ # RUN_JUPYTER=$RUN_JUPYTER\ # RUN_TENSORBOARD=$RUN_TENSORBOARD\ # LANG_LABEL=eng-c\ # DATASET_LABEL=$DATASET_LABEL\ # METHOD_LABEL=$METHOD_LABEL\ # LANG_DIR=data/conll2003/eng\ # TRAIN_DATA=entity.train-docs$TRAIN_SUFFIX.jsonl\ # DEV_DATA=entity.dev-docs.jsonl\ # TEST_DATA=entity.test-docs.jsonl\ # VOCAB_PATH=data/conll2003/mayhew-entity.vocab\ # BINARY_VOCAB_PATH=data/conll2003/mayhew-binary-entity.vocab\ # VECTORS_PATH=data/vectors/glove.6B.50d.txt # # Conll german # # tacl-eer_deu_ee-short_bcl-bert # bash scripts/run_remote_mayhew19_experiment.sh\ # PUBLIC_IP=100.26.179.144\ # PRIVATE_IP=172.31.59.23\ # RUN_JUPYTER=$RUN_JUPYTER\ # RUN_TENSORBOARD=$RUN_TENSORBOARD\ # LANG_LABEL=deu\ # DATASET_LABEL=$DATASET_LABEL\ # METHOD_LABEL=$METHOD_LABEL\ # LANG_DIR=data/conll2003/deu\ # TRAIN_DATA=entity.train-docs$TRAIN_SUFFIX.jsonl\ # DEV_DATA=entity.dev-docs.jsonl\ # TEST_DATA=entity.test-docs.jsonl\ # VOCAB_PATH=data/conll2003/mayhew-entity.vocab\ # BINARY_VOCAB_PATH=data/conll2003/mayhew-binary-entity.vocab\ # VECTORS_PATH=data/vectors/fasttext.deu.300.vec # Conll spanish # tacl-eer_esp_ee-short_bcl-bert bash scripts/run_remote_mayhew19_experiment.sh\ PUBLIC_IP=44.192.94.173\ PRIVATE_IP=172.31.56.152\ RUN_JUPYTER=$RUN_JUPYTER\ RUN_TENSORBOARD=$RUN_TENSORBOARD\ LANG_LABEL=esp\ DATASET_LABEL=$DATASET_LABEL\ METHOD_LABEL=$METHOD_LABEL\ LANG_DIR=data/conll2003/esp\ TRAIN_DATA=entity.train-docs$TRAIN_SUFFIX.jsonl\ DEV_DATA=entity.dev-docs.jsonl\ TEST_DATA=entity.test-docs.jsonl\ VOCAB_PATH=data/conll2003/mayhew-entity.vocab\ BINARY_VOCAB_PATH=data/conll2003/mayhew-binary-entity.vocab\ VECTORS_PATH=data/vectors/fasttext.esp.300.vec # # Conll dutch # # tacl-eer_ned_ee-short_bcl-bert # bash scripts/run_remote_mayhew19_experiment.sh\ # PUBLIC_IP=3.234.245.7\ # PRIVATE_IP=172.31.58.27\ # RUN_JUPYTER=$RUN_JUPYTER\ # RUN_TENSORBOARD=$RUN_TENSORBOARD\ # LANG_LABEL=ned\ # DATASET_LABEL=$DATASET_LABEL\ # METHOD_LABEL=$METHOD_LABEL\ # LANG_DIR=data/conll2003/ned\ # TRAIN_DATA=entity.train-docs$TRAIN_SUFFIX.jsonl\ # DEV_DATA=entity.dev-docs.jsonl\ # TEST_DATA=entity.test-docs.jsonl\ # VOCAB_PATH=data/conll2003/mayhew-entity.vocab\ # BINARY_VOCAB_PATH=data/conll2003/mayhew-binary-entity.vocab\ # VECTORS_PATH=data/vectors/fasttext.ned.300.vec # # Ontonotes english # # tacl-eer_eng-o_ee-short_bcl-bert # bash scripts/run_remote_mayhew19_experiment.sh\ # PUBLIC_IP=3.234.214.4\ # PRIVATE_IP=172.31.58.51\ # RUN_JUPYTER=$RUN_JUPYTER\ # RUN_TENSORBOARD=$RUN_TENSORBOARD\ # LANG_LABEL=eng-o\ # DATASET_LABEL=$DATASET_LABEL\ # METHOD_LABEL=$METHOD_LABEL\ # LANG_DIR=data/ontonotes5/processed_docs/english\ # TRAIN_DATA=train$TRAIN_SUFFIX.jsonl\ # DEV_DATA=dev.jsonl\ # TEST_DATA=test.jsonl\ # VOCAB_PATH=data/ontonotes5/processed_docs/mayhew-vocab\ # BINARY_VOCAB_PATH=data/ontonotes5/processed_docs/mayhew-binary-vocab\ # VECTORS_PATH=data/vectors/glove.6B.50d.txt # # Ontonotes chinese # # tacl-eer_chi_ee-short_bcl-bert # bash scripts/run_remote_mayhew19_experiment.sh\ # PUBLIC_IP=3.239.88.15\ # PRIVATE_IP=172.31.60.253\ # RUN_JUPYTER=$RUN_JUPYTER\ # RUN_TENSORBOARD=$RUN_TENSORBOARD\ # LANG_LABEL=chi\ # DATASET_LABEL=$DATASET_LABEL\ # METHOD_LABEL=$METHOD_LABEL\ # LANG_DIR=data/ontonotes5/processed_docs/chinese\ # TRAIN_DATA=train$TRAIN_SUFFIX.jsonl\ # DEV_DATA=dev.jsonl\ # TEST_DATA=test.jsonl\ # VOCAB_PATH=data/ontonotes5/processed_docs/mayhew-vocab\ # BINARY_VOCAB_PATH=data/ontonotes5/processed_docs/mayhew-binary-vocab\ # VECTORS_PATH=data/vectors/fasttext.chi.300.vec # # Ontonotes arabic # # tacl-eer_ara_ee-short_bcl-bert # bash scripts/run_remote_mayhew19_experiment.sh\ # PUBLIC_IP=3.234.217.215\ # PRIVATE_IP=172.31.50.138\ # RUN_JUPYTER=$RUN_JUPYTER\ # RUN_TENSORBOARD=$RUN_TENSORBOARD\ # LANG_LABEL=ara\ # DATASET_LABEL=$DATASET_LABEL\ # METHOD_LABEL=$METHOD_LABEL\ # LANG_DIR=data/ontonotes5/processed_docs/arabic\ # TRAIN_DATA=train$TRAIN_SUFFIX.jsonl\ # DEV_DATA=dev.jsonl\ # TEST_DATA=test.jsonl\ # VOCAB_PATH=data/ontonotes5/processed_docs/mayhew-vocab\ # BINARY_VOCAB_PATH=data/ontonotes5/processed_docs/mayhew-binary-vocab\ # VECTORS_PATH=data/vectors/fasttext.ara.300.vec
#!/usr/bin/env bash # Start from root where this script resides cd "$(dirname "$0")" DOTFILES_ROOT=$(pwd) # Exit immediately if a command exits with a non-zero status. set -e echo '' # Helper for presenting info to the user info () { printf " [ \033[00;34m..\033[0m ] $1\r" } # Helper for prompting user for more info user () { printf "\r [ \033[0;33m?\033[0m ] $1 " } # Helper for successful messages success () { printf "\r\033[2K [ \033[00;32mOK\033[0m ] $1\n" } # Helper for problems in setting up fail () { printf "\r\033[2K [\033[0;31mFAIL\033[0m] $1\n" echo '' exit } # Helper for installing dotfiles link_file () { local src=$1 dst=$2 local overwrite= backup= skip= local action= if [ -f "$dst" -o -d "$dst" -o -L "$dst" ] then if [ "$overwrite_all" == "false" ] && [ "$backup_all" == "false" ] && [ "$skip_all" == "false" ] then local currentSrc="$(readlink $dst)" if [ "$currentSrc" == "$src" ] then skip=true; else user "File already exists: $dst ($(basename "$src")), what do you want to do?\n\ [s]kip, [S]kip all, [o]verwrite, [O]verwrite all, [b]ackup, [B]ackup all?" read -n 1 action case "$action" in o ) overwrite=true;; O ) overwrite_all=true;; b ) backup=true;; B ) backup_all=true;; s ) skip=true;; S ) skip_all=true;; * ) ;; esac fi fi overwrite=${overwrite:-$overwrite_all} backup=${backup:-$backup_all} skip=${skip:-$skip_all} if [ "$overwrite" == "true" ] then rm -rf "$dst" success "removed $dst" fi if [ "$backup" == "true" ] then mv "$dst" "${dst}.backup" success "moved $dst to ${dst}.backup" fi if [ "$skip" == "true" ] then success "skipped $src" fi fi if [ "$skip" != "true" ] # "false" or empty then ln -s "$1" "$2" success "linked $1 to $2" fi } # Searches for local files and renames them into the home # directory root. install_dotfiles () { info 'installing dotfiles' local overwrite_all=false backup_all=false skip_all=false for src in $(find -H "$DOTFILES_ROOT" -maxdepth 2 -name '*.symlink') do dst="$HOME/.$(basename "${src%.*}")" echo $src $dst link_file "$src" "$dst" done } # Main install_dotfiles; echo '' echo ' Dotfile setup complete!'
<filename>include/serial.h /*****************************************************************************/ /* */ /* serial.h */ /* */ /* Serial communication API */ /* */ /* */ /* */ /* (C) 2003-2012, <NAME> */ /* Roemerstrasse 52 */ /* D-70794 Filderstadt */ /* EMail: <EMAIL> */ /* */ /* */ /* This software is provided 'as-is', without any expressed or implied */ /* warranty. In no event will the authors be held liable for any damages */ /* arising from the use of this software. */ /* */ /* Permission is granted to anyone to use this software for any purpose, */ /* including commercial applications, and to alter it and redistribute it */ /* freely, subject to the following restrictions: */ /* */ /* 1. The origin of this software must not be misrepresented; you must not */ /* claim that you wrote the original software. If you use this software */ /* in a product, an acknowledgment in the product documentation would be */ /* appreciated but is not required. */ /* 2. Altered source versions must be plainly marked as such, and must not */ /* be misrepresented as being the original software. */ /* 3. This notice may not be removed or altered from any source */ /* distribution. */ /* */ /*****************************************************************************/ #ifndef _SERIAL_H #define _SERIAL_H /*****************************************************************************/ /* Data */ /*****************************************************************************/ /* Baudrate settings */ #define SER_BAUD_45_5 0x00 #define SER_BAUD_50 0x01 #define SER_BAUD_75 0x02 #define SER_BAUD_110 0x03 #define SER_BAUD_134_5 0x04 #define SER_BAUD_150 0x05 #define SER_BAUD_300 0x06 #define SER_BAUD_600 0x07 #define SER_BAUD_1200 0x08 #define SER_BAUD_1800 0x09 #define SER_BAUD_2400 0x0A #define SER_BAUD_3600 0x0B #define SER_BAUD_4800 0x0C #define SER_BAUD_7200 0x0D #define SER_BAUD_9600 0x0E #define SER_BAUD_19200 0x0F #define SER_BAUD_38400 0x10 #define SER_BAUD_57600 0x11 #define SER_BAUD_115200 0x12 #define SER_BAUD_230400 0x13 #define SER_BAUD_31250 0x14 #define SER_BAUD_62500 0x15 #define SER_BAUD_56_875 0x16 /* Data bit settings */ #define SER_BITS_5 0x00 #define SER_BITS_6 0x01 #define SER_BITS_7 0x02 #define SER_BITS_8 0x03 /* Stop bit settings */ #define SER_STOP_1 0x00 /* One stop bit */ #define SER_STOP_2 0x01 /* Two stop bits */ /* Parity settings */ #define SER_PAR_NONE 0x00 #define SER_PAR_ODD 0x01 #define SER_PAR_EVEN 0x02 #define SER_PAR_MARK 0x03 #define SER_PAR_SPACE 0x04 /* Handshake settings. The latter two may be combined. */ #define SER_HS_NONE 0x00 /* No handshake */ #define SER_HS_HW 0x01 /* Hardware (RTS/CTS) handshake */ #define SER_HS_SW 0x02 /* Software handshake */ /* Bit masks to mask out things from the status returned by ser_status. ** These are 6551 specific and must be mapped by drivers for other chips. */ #define SER_STATUS_PE 0x01 /* Parity error */ #define SER_STATUS_FE 0x02 /* Framing error */ #define SER_STATUS_OE 0x04 /* Overrun error */ #define SER_STATUS_DCD 0x20 /* NOT data carrier detect */ #define SER_STATUS_DSR 0x40 /* NOT data set ready */ /* Error codes returned by all functions */ #define SER_ERR_OK 0x00 /* Not an error - relax */ #define SER_ERR_NO_DRIVER 0x01 /* No driver available */ #define SER_ERR_CANNOT_LOAD 0x02 /* Error loading driver */ #define SER_ERR_INV_DRIVER 0x03 /* Invalid driver */ #define SER_ERR_NO_DEVICE 0x04 /* Device (hardware) not found */ #define SER_ERR_BAUD_UNAVAIL 0x05 /* Baud rate not available */ #define SER_ERR_NO_DATA 0x06 /* Nothing to read */ #define SER_ERR_OVERFLOW 0x07 /* No room in send buffer */ #define SER_ERR_INIT_FAILED 0x08 /* Initialization failed */ #define SER_ERR_INV_IOCTL 0x09 /* IOCTL not supported */ #define SER_ERR_INSTALLED 0x0A /* A driver is already installed */ #define SER_ERR_NOT_OPEN 0x0B /* Driver is not open */ /* Struct containing parameters for the serial port */ struct ser_params { unsigned char baudrate; /* Baudrate */ unsigned char databits; /* Number of data bits */ unsigned char stopbits; /* Number of stop bits */ unsigned char parity; /* Parity setting */ unsigned char handshake; /* Type of handshake to use */ }; /*****************************************************************************/ /* Code */ /*****************************************************************************/ unsigned char __fastcall__ ser_load_driver (const char* driver); /* Load and install a serial driver. Return an error code. */ unsigned char ser_unload (void); /* Uninstall, then unload the currently loaded driver. */ unsigned char __fastcall__ ser_install (void* driver); /* Install an already loaded driver. Return an error code. */ unsigned char ser_uninstall (void); /* Uninstall the currently loaded driver and return an error code. ** Note: This call does not free allocated memory. */ unsigned char __fastcall__ ser_open (const struct ser_params* params); /* "Open" the port by setting the port parameters and enable interrupts. */ unsigned char ser_close (void); /* "Close" the port. Clear buffers and and disable interrupts. */ unsigned char __fastcall__ ser_get (char* b); /* Get a character from the serial port. If no characters are available, the ** function will return SER_ERR_NO_DATA, so this is not a fatal error. */ unsigned char __fastcall__ ser_put (char b); /* Send a character via the serial port. There is a transmit buffer, but ** transmitting is not done via interrupt. The function returns ** SER_ERR_OVERFLOW if there is no space left in the transmit buffer. */ unsigned char __fastcall__ ser_status (unsigned char* status); /* Return the serial port status. */ unsigned char __fastcall__ ser_ioctl (unsigned char code, void* data); /* Driver specific entry. */ /* End of serial.h */ #endif
import argparse import os def new_item(path, exists_ok): if os.path.exists(path): # Check if the file or directory already exists if exists_ok: # If exists_ok is True, do nothing pass else: # If exists_ok is False, raise a FileExistsError raise FileExistsError(f"{path} already exists.") else: # If the file or directory does not exist, create a new file or directory if os.path.isdir(path): # Check if the path is a directory os.makedirs(path, exist_ok=True) # Create the directory if it doesn't exist else: # If the path is a file with open(path, 'w'): # Create the file if it doesn't exist pass
<filename>src/test/java/com/hack23/maven/plugin/SonarQualityGatesMojoTest.java<gh_stars>0 package com.hack23.maven.plugin; import java.io.IOException; import java.io.OutputStream; import java.lang.reflect.Field; import java.net.InetSocketAddress; import java.util.Scanner; import org.apache.maven.plugin.Mojo; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; import org.apache.maven.plugin.testing.MojoRule; import org.apache.maven.plugin.testing.resources.TestResources; import org.apache.maven.project.MavenProject; import org.junit.After; import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; import com.mashape.unirest.http.Unirest; import com.sun.net.httpserver.HttpExchange; import com.sun.net.httpserver.HttpHandler; import com.sun.net.httpserver.HttpServer; public class SonarQualityGatesMojoTest { @Rule public MojoRule rule = new MojoRule(); @Rule public TestResources resources = new TestResources(); @Rule public ExpectedException exception = ExpectedException.none(); private HttpServer server; private SonarEventHandler sonarEventHandler; private Mojo mojo; private MavenProject project; @Before public void setUp() throws Exception { sonarEventHandler = new SonarEventHandler(); server = HttpServer.create(new InetSocketAddress(0), 0); server.createContext("/", sonarEventHandler); server.setExecutor(null); server.start(); project = rule.readMavenProject(resources.getBasedir("")); mojo = rule.lookupConfiguredMojo(project, "inspect"); project.getProperties().put("sonar.host.url", "http://localhost:" + server.getAddress().getPort()); } @After public void tearDown() { server.stop(0); } @Test public void failedQualityGateTest() throws Exception { exception.expect(MojoExecutionException.class); exception.expectMessage("Failed quality gate\n" + "Conditions[op=LT,period=1,metric=new_coverage,level=ERROR,error=95,actual=47.05882352941177]\n" + "Conditions[op=LT,period=<null>,metric=coverage,level=ERROR,error=95,actual=47.4]"); sonarEventHandler.setResponse(200, getResponse("failedqualitygate.json")); mojo.execute(); } @Test public void passedQualityGateTest() throws MojoFailureException, MojoExecutionException { sonarEventHandler.setResponse(200, getResponse("passedqualitygate.json")); mojo.execute(); } @Test public void failedMissingProjectQualityGateTest() throws MojoFailureException, MojoExecutionException { exception.expect(MojoExecutionException.class); exception.expectMessage("no matching project in sonarqube for project key:com.hack23.maven:test-sonar-quality-gates-maven-plugin"); sonarEventHandler.setResponse(200, getResponse("missingproject.json")); mojo.execute(); } @Test public void sonarProjectKeyPropertyTest() throws MojoFailureException, MojoExecutionException, Exception, SecurityException { sonarEventHandler.setResponse(200, getResponse("passedqualitygate.json")); project.getProperties().put("sonar.projectKey", "com.hack23.maven:test-property"); final Field f1 = mojo.getClass().getDeclaredField("sonarHostUrl"); f1.setAccessible(true); f1.set(mojo, "http://localhost:" + server.getAddress().getPort()); mojo.execute(); } @Test public void sonarqube404Test() throws Exception { exception.expect(MojoFailureException.class); exception.expectMessage( "Attempt to call Sonarqube responded with an error status :404 : for url:http://localhost:" + server.getAddress().getPort() + "/api/measures/search?projectKeys=com.hack23.maven:test-sonar-quality-gates-maven-plugin&metricKeys=alert_status,quality_gate_details : response: "); sonarEventHandler.setResponse(404, ""); mojo.execute(); } @Test public void unirestExceptionTest() throws MojoFailureException, MojoExecutionException { exception.expect(MojoFailureException.class); exception.expectMessage("Could not execute sonar-quality-gates-plugin"); Unirest.setHttpClient(null); mojo.execute(); } private String getResponse(final String file) { return new Scanner(getClass().getClassLoader().getResourceAsStream(file)).useDelimiter("\\Z").next(); } private static final class SonarEventHandler implements HttpHandler { private String response = "[]"; private int status = 200; public void handle(final HttpExchange httpExchange) throws IOException { try (OutputStream responseBody = httpExchange.getResponseBody()) { httpExchange.sendResponseHeaders(status, response.length()); responseBody.write(response.getBytes()); } } public void setResponse(final int status, final String response) { this.status = status; this.response = response; } } }
package gv.jleon package test trait Generators extends Any with UriGenerator object Generators extends Generators
#!/bin/sh sh /docker-entrypoint-nginx.sh nginx eiffelvis "$@"
from helper import readLevel from agent import BFSAgent, DFSAgent, AStarAgent #Load Level number 0 state = readLevel(0) #Initialize Different Agents astar = AStarAgent() bfs = BFSAgent() dfs = DFSAgent() #Get Solution and Priting them print(state) state.render('image').save('start.png') sol, bestNode, steps = astar.getSolution(state, 1) bestNode.state.render('image').save('astar.png') sol, bestNode, steps = bfs.getSolution(state) bestNode.state.render('image').save('bfs.png') sol, bestNode, steps = dfs.getSolution(state) bestNode.state.render('image').save('dfs.png') print(bestNode.state)
<reponame>skoussa/hashbrown-cms 'use strict'; /** * @namespace HashBrown.Client.Entity.View.ProcessorEditor */ namespace('Entity.View.ProcessorEditor') .add(require('./ProcessorEditorBase.js'));
<filename>pyvcloud/vcd/vapp_static_route.py # VMware vCloud Director Python SDK # Copyright (c) 2014-2019 VMware, Inc. All Rights Reserved. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from pyvcloud.vcd.client import E from pyvcloud.vcd.client import EntityType from pyvcloud.vcd.client import RelationType from pyvcloud.vcd.exceptions import EntityNotFoundException from pyvcloud.vcd.exceptions import InvalidParameterException from pyvcloud.vcd.vapp_services import VappServices class VappStaticRoute(VappServices): def _makeStaticRouteServiceAttr(features): route_service = E.StaticRoutingService() route_service.append(E.IsEnabled(True)) features.append(route_service) def enable_service(self, isEnable): """Enable static route service to vApp network. :param bool isEnable: True for enable and False for Disable. :return: an object containing EntityType.TASK XML data which represents the asynchronous task that is updating the vApp network. :rtype: lxml.objectify.ObjectifiedElement :raises: InvalidParameterException: Enable static route service failed as given network's connection is not routed """ self._get_resource() fence_mode = self.resource.Configuration.FenceMode if fence_mode != 'natRouted': raise InvalidParameterException( "Enable static route service failed as given network's " "connection is not routed") features = self.resource.Configuration.Features if not hasattr(features, 'StaticRoutingService'): VappStaticRoute._makeStaticRouteServiceAttr(features) route = features.StaticRoutingService route.IsEnabled = E.IsEnabled(isEnable) return self.client.put_linked_resource(self.resource, RelationType.EDIT, EntityType.vApp_Network.value, self.resource) def add(self, name, network_cidr, next_hop_ip): """Add static route to vApp network. :param str name: name of route. :param str network_cidr: network CIDR. :param str next_hop_ip: next hop IP. :return: an object containing EntityType.TASK XML data which represents the asynchronous task that is updating the vApp network. :rtype: lxml.objectify.ObjectifiedElement :raises: InvalidParameterException: Add route to static route service failed as given network's connection is not routed """ self._get_resource() fence_mode = self.resource.Configuration.FenceMode if fence_mode != 'natRouted': raise InvalidParameterException( "Add route to static route service failed as given network's " "connection is not routed") features = self.resource.Configuration.Features if not hasattr(features, 'StaticRoutingService'): VappStaticRoute._makeStaticRouteServiceAttr(features) route_service = features.StaticRoutingService static_route = E.StaticRoute() static_route.append(E.Name(name)) static_route.append(E.Network(network_cidr)) static_route.append(E.NextHopIp(next_hop_ip)) route_service.append(static_route) return self.client.put_linked_resource(self.resource, RelationType.EDIT, EntityType.vApp_Network.value, self.resource) def list(self): """List static route of vApp network. :return: list of dictionary contain detail of static route. :rtype: list """ list_of_route = [] self._get_resource() fence_mode = self.resource.Configuration.FenceMode if fence_mode != 'natRouted': return list_of_route features = self.resource.Configuration.Features if not hasattr(features, 'StaticRoutingService'): return list_of_route route_service = features.StaticRoutingService for route in route_service.StaticRoute: result = {} result['Name'] = route.Name result['Network CIDR'] = route.Network result['Next Hop IP'] = route.NextHopIp list_of_route.append(result) return list_of_route def update(self, name, new_name=None, network_cidr=None, next_hop_ip=None): """Update static route to vApp network. :param str name: name of route. :param str new_name: new name of route. :param str network_cidr: network CIDR. :param str next_hop_ip: next hop IP. :return: an object containing EntityType.TASK XML data which represents the asynchronous task that is updating the vApp network. :rtype: lxml.objectify.ObjectifiedElement :raises: InvalidParameterException: Update route to static route service failed as given network's connection is not routed :raises: EntityNotFoundException: if the static route not exist of given name. """ self._get_resource() fence_mode = self.resource.Configuration.FenceMode if fence_mode != 'natRouted': raise InvalidParameterException( "Update route to static route service failed as given " "network's connection is not routed") features = self.resource.Configuration.Features if not hasattr(features, 'StaticRoutingService'): raise EntityNotFoundException('static route ' + name + ' doesn\'t exist.') route_service = features.StaticRoutingService is_updated = False for route in route_service.StaticRoute: if route.Name == name: if new_name is not None: route.Name = E.Name(new_name) if network_cidr is not None: route.Network = E.Network(network_cidr) if next_hop_ip is not None: route.NextHopIp = E.NextHopIp(next_hop_ip) is_updated = True if not is_updated: raise EntityNotFoundException('static route ' + name + ' doesn\'t exist.') else: return self.client.put_linked_resource( self.resource, RelationType.EDIT, EntityType.vApp_Network.value, self.resource) def delete(self, name): """Delete static route from vApp network. :param str name: name of static route. :return: an object containing EntityType.TASK XML data which represents the asynchronous task that is updating the vApp network. :rtype: lxml.objectify.ObjectifiedElement :raises: InvalidParameterException: Delete route to static route service failed as given network's connection is not routed :raises: EntityNotFoundException: if the static route not exist of given name. """ self._get_resource() fence_mode = self.resource.Configuration.FenceMode if fence_mode != 'natRouted': raise InvalidParameterException( "Delete route to static route service failed as given " "network's connection is not routed") features = self.resource.Configuration.Features if not hasattr(features, 'StaticRoutingService'): raise EntityNotFoundException('static route ' + name + ' doesn\'t exist.') route_service = features.StaticRoutingService is_deleted = False for route in route_service.StaticRoute: if route.Name == name: route_service.remove(route) is_deleted = True if not is_deleted: raise EntityNotFoundException('static route ' + name + ' doesn\'t exist.') else: return self.client.put_linked_resource( self.resource, RelationType.EDIT, EntityType.vApp_Network.value, self.resource)
<reponame>Symphoomc1f/krexusj package com.java110.things.adapt.accessControl.sxoa; public class SxAddMachineResultDto { private String dId; private String dParentId; private String dDtId; private String dOrgId; private String dViId; private String dDatId; private String dCode; private String dName; private String dDescription; private String dIsValid; private String dCreationOrg; private String dRomVersion; private String dMcuVersion; private String dDimensions; private String dStatus; private String dFaceSdkType; private String dVolumeValue; private String dAppVersion; private String dCreateTime; private String dUpdateTime; private String dLightValue; private String dLockType; private String dWarnSrc; private String dWarnData; private String dRealUpload; private String dPwd; private String dVoiceCall; private String viAreaCode; private String viName; private String dtName; private String orgName; public String getdId() { return dId; } public void setdId(String dId) { this.dId = dId; } public String getdParentId() { return dParentId; } public void setdParentId(String dParentId) { this.dParentId = dParentId; } public String getdDtId() { return dDtId; } public void setdDtId(String dDtId) { this.dDtId = dDtId; } public String getdOrgId() { return dOrgId; } public void setdOrgId(String dOrgId) { this.dOrgId = dOrgId; } public String getdViId() { return dViId; } public void setdViId(String dViId) { this.dViId = dViId; } public String getdDatId() { return dDatId; } public void setdDatId(String dDatId) { this.dDatId = dDatId; } public String getdCode() { return dCode; } public void setdCode(String dCode) { this.dCode = dCode; } public String getdName() { return dName; } public void setdName(String dName) { this.dName = dName; } public String getdDescription() { return dDescription; } public void setdDescription(String dDescription) { this.dDescription = dDescription; } public String getdIsValid() { return dIsValid; } public void setdIsValid(String dIsValid) { this.dIsValid = dIsValid; } public String getdCreationOrg() { return dCreationOrg; } public void setdCreationOrg(String dCreationOrg) { this.dCreationOrg = dCreationOrg; } public String getdRomVersion() { return dRomVersion; } public void setdRomVersion(String dRomVersion) { this.dRomVersion = dRomVersion; } public String getdMcuVersion() { return dMcuVersion; } public void setdMcuVersion(String dMcuVersion) { this.dMcuVersion = dMcuVersion; } public String getdDimensions() { return dDimensions; } public void setdDimensions(String dDimensions) { this.dDimensions = dDimensions; } public String getdStatus() { return dStatus; } public void setdStatus(String dStatus) { this.dStatus = dStatus; } public String getdFaceSdkType() { return dFaceSdkType; } public void setdFaceSdkType(String dFaceSdkType) { this.dFaceSdkType = dFaceSdkType; } public String getdVolumeValue() { return dVolumeValue; } public void setdVolumeValue(String dVolumeValue) { this.dVolumeValue = dVolumeValue; } public String getdAppVersion() { return dAppVersion; } public void setdAppVersion(String dAppVersion) { this.dAppVersion = dAppVersion; } public String getdCreateTime() { return dCreateTime; } public void setdCreateTime(String dCreateTime) { this.dCreateTime = dCreateTime; } public String getdUpdateTime() { return dUpdateTime; } public void setdUpdateTime(String dUpdateTime) { this.dUpdateTime = dUpdateTime; } public String getdLightValue() { return dLightValue; } public void setdLightValue(String dLightValue) { this.dLightValue = dLightValue; } public String getdLockType() { return dLockType; } public void setdLockType(String dLockType) { this.dLockType = dLockType; } public String getdWarnSrc() { return dWarnSrc; } public void setdWarnSrc(String dWarnSrc) { this.dWarnSrc = dWarnSrc; } public String getdWarnData() { return dWarnData; } public void setdWarnData(String dWarnData) { this.dWarnData = dWarnData; } public String getdRealUpload() { return dRealUpload; } public void setdRealUpload(String dRealUpload) { this.dRealUpload = dRealUpload; } public String getdPwd() { return dPwd; } public void setdPwd(String dPwd) { this.dPwd = dPwd; } public String getdVoiceCall() { return dVoiceCall; } public void setdVoiceCall(String dVoiceCall) { this.dVoiceCall = dVoiceCall; } public String getViAreaCode() { return viAreaCode; } public void setViAreaCode(String viAreaCode) { this.viAreaCode = viAreaCode; } public String getViName() { return viName; } public void setViName(String viName) { this.viName = viName; } public String getDtName() { return dtName; } public void setDtName(String dtName) { this.dtName = dtName; } public String getOrgName() { return orgName; } public void setOrgName(String orgName) { this.orgName = orgName; } }
#!/usr/bin/env python """ Problem 20 daily-coding-problem.com """ class Node: def __init__(self, value, next=None): self.value = value self.next = next def __repr__(self): return " -> ".join([str(i.value) for i in self]) def __iter__(self): cur = self while cur is not None: yield cur cur = cur.next def find_intersection(left: Node, right: Node) -> int: visited = set(left) for cur_right in right: if cur_right in visited: return cur_right.value return None if __name__ == "__main__": x = Node(8, Node(10)) a = Node(3, Node(7, x)) b = Node(99, Node(1, x)) assert find_intersection(a, b) == 8
#!/bin/bash HTSLIB_VERSION=${1} SAMTOOLS_VERSION=${HTSLIB_VERSION} BCFTOOLS_VERSION=${HTSLIB_VERSION} curl -LO https://github.com/samtools/samtools/releases/download/${SAMTOOLS_VERSION}/samtools-${SAMTOOLS_VERSION}.tar.bz2 tar xvf samtools-${SAMTOOLS_VERSION}.tar.bz2 cd samtools-${SAMTOOLS_VERSION} # build htslib (including tabix and bgzip) cd htslib-${HTSLIB_VERSION} ./configure --without-curses make -j4 strip tabix strip bgzip # build samtools cd .. ./configure --without-curses make -j4 strip samtools cd / curl -LO https://github.com/samtools/bcftools/releases/download/${BCFTOOLS_VERSION}/bcftools-${BCFTOOLS_VERSION}.tar.bz2 tar xvf bcftools-${BCFTOOLS_VERSION}.tar.bz2 cd bcftools-${BCFTOOLS_VERSION} ./configure --without-curses make -j4 strip bcftools
<filename>common/src/main/java/org/apache/falcon/entity/Storage.java<gh_stars>0 /** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.falcon.entity; import org.apache.falcon.FalconException; import org.apache.falcon.entity.v0.feed.LocationType; /** * A class to encapsulate the storage for a given feed which can either be * expressed as a path on the file system or a table in a catalog. */ public interface Storage { String DOLLAR_EXPR_START_REGEX = "\\$\\{"; String QUESTION_EXPR_START_REGEX = "\\?\\{"; String EXPR_CLOSE_REGEX = "\\}"; /** * URI Friendly expression. */ String DOLLAR_EXPR_START_NORMALIZED = "_D__START_"; String EXPR_CLOSE_NORMALIZED = "_CLOSE_"; /** * Enumeration for the various storage types. */ enum TYPE {FILESYSTEM, TABLE} /** * Return the type of storage. * * @return storage type */ TYPE getType(); /** * Return the uri template. * * @return uri template */ String getUriTemplate(); /** * Return the uri template for a given location type. * * @param locationType type of location, applies only to filesystem type * @return uri template */ String getUriTemplate(LocationType locationType); /** * Check for equality of this instance against the one in question. * * @param toCompareAgainst instance to compare * @return true if identical else false * @throws FalconException an exception */ boolean isIdentical(Storage toCompareAgainst) throws FalconException; }
exports = module.exports = {}; exports.MiddlewareMustBeArrayError = () => TypeError("Middleware stack must be an array!"); exports.MiddlewareArrayOfFunctionsError = () => TypeError("Middleware must be composed of functions!"); exports.CloneFunctionError = () => TypeError("Functional compose function must have a 'clone' function."); exports.MultipleNextCallsError = () => Error("next() called multiple times");
<filename>lib/kora_skincare/scraper.rb class KoraSkincare::Scraper def self.scrape_by_category_url(category_url) page = Nokogiri::HTML(open(category_url)) page.css("div.product-item.columns.large-3").each do |product| new_product = KoraSkincare::Product.new new_product.name = product.css("div.caption a").text.split.join(' ') new_product.type = page.css("div.row article.description.columns h3").children[0].text new_product.price = product.css("p.price span.money").text new_product.url = "https://us.koraorganics.com" + product.css("p.title a").attribute("href").value end end end # End KoraSkincare::Scraper method
import type { Flatten } from "../types/mod.ts"; import { isAsyncIterable, isIterable } from "../types/guards/mod.ts"; async function* _flatten_impl_fn<T>( iter: AsyncIterable<T>, ): AsyncIterable<Flatten<T>> { for await (const elem of iter) { if (isIterable(elem) || isAsyncIterable(elem)) { yield* elem; } else { yield elem as Flatten<T>; } } } export function flatten<T>(iter: AsyncIterable<T>): AsyncIterable<Flatten<T>> { return _flatten_impl_fn(iter); }
package ca.nova.gestion.services; import ca.nova.gestion.errors.exceptions.RessourceNotFound; import ca.nova.gestion.mappers.TypeUserMapper; import ca.nova.gestion.model.TypeUser; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.ArrayList; @Service public class TypeUserService { private final TypeUserMapper typeUserMapper; @Autowired public TypeUserService(TypeUserMapper typeUserMapper) { this.typeUserMapper = typeUserMapper; } @Transactional public ArrayList<TypeUser> getAllUserTypes() { ArrayList<TypeUser> userTypes = typeUserMapper.getAllUserTypes(); if (userTypes == null) throw new RessourceNotFound("No typeUsers available"); return userTypes; } }
<gh_stars>0 package org.tarantool.orm.auto; import com.google.common.primitives.*; import com.squareup.javapoet.*; import org.tarantool.orm.internals.Meta; import javax.lang.model.element.Modifier; import javax.lang.model.type.ArrayType; import javax.lang.model.type.TypeKind; import javax.lang.model.type.TypeMirror; final class DataClassMetaGenerator { private final ClassName list = ClassName.get("java.util", "List"); private final ParameterizedTypeName wildCardList = ParameterizedTypeName.get(list, WildcardTypeName.subtypeOf(Object.class)); private final ParameterizedTypeName listOfObjects = ParameterizedTypeName.get(list, ClassName.OBJECT); private final ClassName arrayList = ClassName.get("java.util", "ArrayList"); private final ClassName collection = ClassName.get("java.util", "Collection"); private final ParameterizedTypeName subtypeOfNumber = ParameterizedTypeName.get(collection, WildcardTypeName.subtypeOf(Number.class)); private final ParameterizedTypeName collectionOfBooleans = ParameterizedTypeName.get(collection, ClassName.get(Boolean.class)); private final ParameterizedTypeName collectionOfCharacters = ParameterizedTypeName.get(collection, ClassName.get(Character.class)); public DataClassMetaGenerator() { } public TypeSpec generate(TupleMeta tupleMeta) { return TypeSpec.classBuilder(tupleMeta.className + "Meta") .addModifiers(Modifier.PRIVATE, Modifier.FINAL) .superclass(ParameterizedTypeName.get(ClassName.get(Meta.class), tupleMeta.classType)) .addMethod(generateDataClassToListMethod(tupleMeta)) .addMethod(generateListToDataClassMethod(tupleMeta)) .build(); } private MethodSpec generateListToDataClassMethod(TupleMeta tupleMeta) { MethodSpec.Builder builder = MethodSpec.methodBuilder("fromList") .addModifiers(Modifier.PUBLIC) .addParameter(wildCardList, "values", Modifier.FINAL) .returns(tupleMeta.classType) .addStatement("$T result = new $T()", tupleMeta.classType, tupleMeta.classType); for (FieldMeta fieldMeta : tupleMeta.fields) { if (Common.isNumber(fieldMeta.field.asType().getKind())) { builder.addCode(handleNumberType(fieldMeta)); } else if (fieldMeta.field.asType().getKind() == TypeKind.ARRAY) { builder.addCode(handleArrayType(fieldMeta)); } else { builder.addCode(handleDeclaredType(fieldMeta)); } } builder.addStatement("return result"); return builder.build(); } private CodeBlock handleDeclaredType(FieldMeta fieldMeta) { return CodeBlock .builder() .addStatement("result.$L(($T) values.get($L))", fieldMeta.setterName, fieldMeta.valueType, fieldMeta.getIndex()) .build(); } private CodeBlock handleNumberType(FieldMeta fieldMeta) { String toValue = fieldMeta.field.asType().getKind().name().toLowerCase() + "Value()"; return CodeBlock .builder() .addStatement("result.$L((($T) values.get($L)).$L)", fieldMeta.setterName, Number.class, fieldMeta.getIndex(), toValue) .build(); } private CodeBlock handleArrayType(FieldMeta fieldMeta) { CodeBlock.Builder builder = CodeBlock.builder(); TypeMirror arrayTypeKind = ((ArrayType) fieldMeta.field.asType()).getComponentType(); if (arrayTypeKind.getKind().isPrimitive()) { builder.add(handlePrimitiveArrayType(arrayTypeKind.getKind(), fieldMeta.setterName, fieldMeta.getIndex())); } else { builder.addStatement("result.$L((($T) values.get($L)).toArray(new $T {}))", fieldMeta.setterName, wildCardList, fieldMeta.getIndex(), fieldMeta.field.asType()); } return builder.build(); } private CodeBlock handlePrimitiveArrayType(TypeKind kind, String setterName, int index) { CodeBlock.Builder builder = CodeBlock.builder(); switch (kind) { case BOOLEAN: builder.addStatement("result.$L($T.toArray(($T) values.get($L)))", setterName, Booleans.class, collectionOfBooleans, index); break; case BYTE: builder.addStatement("result.$L($T.toArray(($T) values.get($L)))", setterName, Bytes.class, subtypeOfNumber, index); break; case SHORT: builder.addStatement("result.$L($T.toArray(($T) values.get($L)))", setterName, Shorts.class, subtypeOfNumber, index); break; case INT: builder.addStatement("result.$L($T.toArray(($T) values.get($L)))", setterName, Ints.class, subtypeOfNumber, index); break; case LONG: builder.addStatement("result.$L($T.toArray(($T) values.get($L)))", setterName, Longs.class, subtypeOfNumber, index); break; case CHAR: builder.addStatement("result.$L($T.toArray(($T) values.get($L)))", setterName, Chars.class, collectionOfCharacters, index); break; case FLOAT: builder.addStatement("result.$L($T.toArray(($T) values.get($L)))", setterName, Floats.class, subtypeOfNumber, index); break; case DOUBLE: builder.addStatement("result.$L($T.toArray(($T) values.get($L)))", setterName, Doubles.class, subtypeOfNumber, index); break; } return builder.build(); } private MethodSpec generateDataClassToListMethod(TupleMeta tupleMeta) { MethodSpec.Builder builder = MethodSpec.methodBuilder("toList") .addModifiers(Modifier.PUBLIC) .addParameter(tupleMeta.classType, "value", Modifier.FINAL) .returns(wildCardList) .addStatement("$T result = new $T<>()", listOfObjects, arrayList); for (FieldMeta fieldMeta : tupleMeta.fields) { builder.addStatement("result.add(value.$L())", fieldMeta.getterName); } builder.addStatement("return result"); return builder.build(); } }
<filename>application/team6-termproject/config/passport/isAuthenticated.js /* * Authentication * * auth middleware for passport login * */ const isAuthenticated = (request, response, next) => { console.log('Hit Auth Middleware'); //console.log(request); if (request.isAuthenticated()){ console.log('Auth Success'); console.log('User: ', request.user); next(); }else{ console.log('Not Authenticated'); response.redirect(303, '/user/login'); } }; module.exports = isAuthenticated;
import { Space, Post, SocialAccount, Profile } from '../substrate/interfaces'; import { CommonContent, SpaceContent, PostContent, CommentContent, ProfileContent } from '../offchain'; import { CommonStruct } from '../substrate'; import { AccountId } from '@polkadot/types/interfaces'; export declare type CommonData<S extends CommonStruct, C extends CommonContent> = { struct: S; content?: C; }; export declare type SocialAccountWithId = SocialAccount & { id: AccountId; }; export declare type SpaceData = CommonData<Space, SpaceContent>; export declare type PostData = CommonData<Post, PostContent>; export declare type CommentData = CommonData<Post, CommentContent>; export declare type ProfileData = CommonData<SocialAccountWithId, ProfileContent> & { profile?: Profile; }; export declare type AnySubsocialData = SpaceData | PostData | CommentData | ProfileData; export declare type PostWithSomeDetails = { post: PostData; ext?: Exclude<PostWithSomeDetails, 'ext'>; owner?: ProfileData; space?: SpaceData; }; export declare type PostWithOwner = Exclude<PostWithSomeDetails, 'owner'> & { owner: ProfileData; }; export declare type PostWithSpace = Exclude<PostWithSomeDetails, 'space'> & { space: SpaceData; }; export declare type PostWithAllDetails = PostWithOwner & PostWithSpace;
#!/bin/bash set -e ### Setup Rust toolchain ####################################################### # Use profile=minimal here to skip installing clippy curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain=$TRAVIS_RUST_VERSION --profile=minimal -y export PATH=$PATH:$HOME/.cargo/bin if [[ $RUN_LINT == 1 ]]; then rustup component add clippy rustup component add rustfmt fi ### Setup python linker flags ################################################## PYTHON_LIB=$(python -c "import sysconfig; print(sysconfig.get_config_var('LIBDIR'))") export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$PYTHON_LIB:$HOME/rust/lib" echo ${LD_LIBRARY_PATH}
import { TreeSelectProps as AntdTreeSelectProps } from 'antd/lib/tree-select'; import { TreeSelect as AntdTreeSelect } from 'antd'; import { merge } from 'lodash'; import React from 'react'; interface TreeSelectOption { value: string; label: React.ReactNode; selectable?: boolean; options?: TreeSelectOption[]; } export interface TreeSelectProps extends AntdTreeSelectProps<string> { options: TreeSelectOption[]; onChange?: (val: string) => void; label: string; title?: string; } const TreeNode = AntdTreeSelect.TreeNode; const renderTreeNode = (options?: TreeSelectOption[]) => { return options?.map((item) => { return ( <TreeNode selectable={item.selectable} key={item.value} value={item.value} title={item.label} > {item.options?.map((child) => { return ( <TreeNode selectable={child.selectable} key={child.value} value={child.value} title={child.label} > {renderTreeNode(child.options)} </TreeNode> ); })} </TreeNode> ); }); }; export function TreeSelect(props: TreeSelectProps) { return ( <AntdTreeSelect {...props} style={merge({ width: '100%' }, props.style)} value={props.value} onChange={props.onChange} > <TreeNode selectable={false} value="" title={props.title || props.label}> {renderTreeNode(props.options)} </TreeNode> </AntdTreeSelect> ); }
#!/bin/sh set -e set -u set -o pipefail function on_error { echo "$(realpath -mq "${0}"):$1: error: Unexpected failure" } trap 'on_error $LINENO' ERR if [ -z ${FRAMEWORKS_FOLDER_PATH+x} ]; then # If FRAMEWORKS_FOLDER_PATH is not set, then there's nowhere for us to copy # frameworks to, so exit 0 (signalling the script phase was successful). exit 0 fi echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" COCOAPODS_PARALLEL_CODE_SIGN="${COCOAPODS_PARALLEL_CODE_SIGN:-false}" SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" # Used as a return value for each invocation of `strip_invalid_archs` function. STRIP_BINARY_RETVAL=0 # This protects against multiple targets copying the same framework dependency at the same time. The solution # was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html RSYNC_PROTECT_TMP_FILES=(--filter "P .*.??????") # Copies and strips a vendored framework install_framework() { if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then local source="${BUILT_PRODUCTS_DIR}/$1" elif [ -r "${BUILT_PRODUCTS_DIR}/$(basename "$1")" ]; then local source="${BUILT_PRODUCTS_DIR}/$(basename "$1")" elif [ -r "$1" ]; then local source="$1" fi local destination="${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" if [ -L "${source}" ]; then echo "Symlinked..." source="$(readlink "${source}")" fi # Use filter instead of exclude so missing patterns don't throw errors. echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --links --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\"" rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --links --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}" local basename basename="$(basename -s .framework "$1")" binary="${destination}/${basename}.framework/${basename}" if ! [ -r "$binary" ]; then binary="${destination}/${basename}" elif [ -L "${binary}" ]; then echo "Destination binary is symlinked..." dirname="$(dirname "${binary}")" binary="${dirname}/$(readlink "${binary}")" fi # Strip invalid architectures so "fat" simulator / device frameworks work on device if [[ "$(file "$binary")" == *"dynamically linked shared library"* ]]; then strip_invalid_archs "$binary" fi # Resign the code if required by the build settings to avoid unstable apps code_sign_if_enabled "${destination}/$(basename "$1")" # Embed linked Swift runtime libraries. No longer necessary as of Xcode 7. if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then local swift_runtime_libs swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u) for lib in $swift_runtime_libs; do echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\"" rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}" code_sign_if_enabled "${destination}/${lib}" done fi } # Copies and strips a vendored dSYM install_dsym() { local source="$1" warn_missing_arch=${2:-true} if [ -r "$source" ]; then # Copy the dSYM into the targets temp dir. echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${DERIVED_FILES_DIR}\"" rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${DERIVED_FILES_DIR}" local basename basename="$(basename -s .dSYM "$source")" binary_name="$(ls "$source/Contents/Resources/DWARF")" binary="${DERIVED_FILES_DIR}/${basename}.dSYM/Contents/Resources/DWARF/${binary_name}" # Strip invalid architectures so "fat" simulator / device frameworks work on device if [[ "$(file "$binary")" == *"Mach-O "*"dSYM companion"* ]]; then strip_invalid_archs "$binary" "$warn_missing_arch" fi if [[ $STRIP_BINARY_RETVAL == 1 ]]; then # Move the stripped file into its final destination. echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --links --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${DERIVED_FILES_DIR}/${basename}.framework.dSYM\" \"${DWARF_DSYM_FOLDER_PATH}\"" rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --links --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${DERIVED_FILES_DIR}/${basename}.dSYM" "${DWARF_DSYM_FOLDER_PATH}" else # The dSYM was not stripped at all, in this case touch a fake folder so the input/output paths from Xcode do not reexecute this script because the file is missing. touch "${DWARF_DSYM_FOLDER_PATH}/${basename}.dSYM" fi fi } # Copies the bcsymbolmap files of a vendored framework install_bcsymbolmap() { local bcsymbolmap_path="$1" local destination="${BUILT_PRODUCTS_DIR}" echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${bcsymbolmap_path}" "${destination}"" rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${bcsymbolmap_path}" "${destination}" } # Signs a framework with the provided identity code_sign_if_enabled() { if [ -n "${EXPANDED_CODE_SIGN_IDENTITY:-}" -a "${CODE_SIGNING_REQUIRED:-}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then # Use the current code_sign_identity echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}" local code_sign_cmd="/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS:-} --preserve-metadata=identifier,entitlements '$1'" if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then code_sign_cmd="$code_sign_cmd &" fi echo "$code_sign_cmd" eval "$code_sign_cmd" fi } # Strip invalid architectures strip_invalid_archs() { binary="$1" warn_missing_arch=${2:-true} # Get architectures for current target binary binary_archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | awk '{$1=$1;print}' | rev)" # Intersect them with the architectures we are building for intersected_archs="$(echo ${ARCHS[@]} ${binary_archs[@]} | tr ' ' '\n' | sort | uniq -d)" # If there are no archs supported by this binary then warn the user if [[ -z "$intersected_archs" ]]; then if [[ "$warn_missing_arch" == "true" ]]; then echo "warning: [CP] Vendored binary '$binary' contains architectures ($binary_archs) none of which match the current build architectures ($ARCHS)." fi STRIP_BINARY_RETVAL=0 return fi stripped="" for arch in $binary_archs; do if ! [[ "${ARCHS}" == *"$arch"* ]]; then # Strip non-valid architectures in-place lipo -remove "$arch" -output "$binary" "$binary" stripped="$stripped $arch" fi done if [[ "$stripped" ]]; then echo "Stripped $binary of architectures:$stripped" fi STRIP_BINARY_RETVAL=1 } install_artifact() { artifact="$1" base="$(basename "$artifact")" case $base in *.framework) install_framework "$artifact" ;; *.dSYM) # Suppress arch warnings since XCFrameworks will include many dSYM files install_dsym "$artifact" "false" ;; *.bcsymbolmap) install_bcsymbolmap "$artifact" ;; *) echo "error: Unrecognized artifact "$artifact"" ;; esac } copy_artifacts() { file_list="$1" while read artifact; do install_artifact "$artifact" done <$file_list } ARTIFACT_LIST_FILE="${BUILT_PRODUCTS_DIR}/cocoapods-artifacts-${CONFIGURATION}.txt" if [ -r "${ARTIFACT_LIST_FILE}" ]; then copy_artifacts "${ARTIFACT_LIST_FILE}" fi if [[ "$CONFIGURATION" == "Debug" ]]; then install_framework "${BUILT_PRODUCTS_DIR}/FDFullscreenPopGesture/FDFullscreenPopGesture.framework" install_framework "${BUILT_PRODUCTS_DIR}/MJRefresh/MJRefresh.framework" fi if [[ "$CONFIGURATION" == "Release" ]]; then install_framework "${BUILT_PRODUCTS_DIR}/FDFullscreenPopGesture/FDFullscreenPopGesture.framework" install_framework "${BUILT_PRODUCTS_DIR}/MJRefresh/MJRefresh.framework" fi if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then wait fi
#! /bin/bash # pip3 install pdoc3 # https://github.com/pdoc3/pdoc # https://github.com/pdoc3/pdoc/issues/6 pdoc --html --force -c show_type_annotations=True dataworks --output-dir docs rm -rf public/ mkdir -p public/ mv docs/dataworks/* public/ touch public/.nojekyll
<reponame>aquartulli/wyvern-tools import React, { Component } from 'react'; export class CharacterSheetAttribute extends Component { constructor(props) { super(props); this.state = { name: props.name, value: props.value }; } render() { return ( <div className="character-sheet-attribute-container"> <div className="character-sheet-attribute-box"> <div className="character-sheet-attribute-name">{this.state.name}</div> <div className="character-sheet-attribute-value">{this.state.value}</div> </div> <div className="character-sheet-modifier-box">{Math.floor((this.state.value - 10) / 2)}</div> </div> ); } }
#!/usr/bin/env bash # NOTE Consider adding support for 'sphinx-doc'. main() { # """ # Install libuv. # @note Updated 2022-04-20. # # @seealso # - https://github.com/Homebrew/homebrew-core/blob/master/Formula/libuv.rb # - https://cran.r-project.org/web/packages/httpuv/index.html # """ local app dict koopa_assert_has_no_args "$#" koopa_activate_build_opt_prefix \ 'autoconf' \ 'automake' \ 'libtool' \ 'pkg-config' declare -A app=( [make]="$(koopa_locate_make)" ) declare -A dict=( [jobs]="$(koopa_cpu_count)" [name]='libuv' [prefix]="${INSTALL_PREFIX:?}" [version]="${INSTALL_VERSION:?}" ) dict[file]="v${dict[version]}.tar.gz" dict[url]="https://github.com/${dict[name]}/${dict[name]}/\ archive/${dict[file]}" koopa_download "${dict[url]}" "${dict[file]}" koopa_extract "${dict[file]}" # Need to create g-prefixed libtools symlinks, otherwise the build will # fail on macOS. dict[opt_prefix]="$(koopa_opt_prefix)" dict[bin_extra]="$(koopa_init_dir 'bin-extra')" koopa_ln \ "${dict[opt_prefix]}/libtool/bin/libtoolize" \ "${dict[bin_extra]}/glibtoolize" koopa_add_to_path_start "${dict[bin_extra]}" koopa_cd "${dict[name]}-${dict[version]}" conf_args=( "--prefix=${dict[prefix]}" '--disable-dependency-tracking' '--disable-silent-rules' ) # This tries to locate 'glibtoolize'. ./autogen.sh ./configure "${conf_args[@]}" "${app[make]}" --jobs="${dict[jobs]}" "${app[make]}" install return 0 }
import Parse, { ParseAddress, AREA, Utils, } from './parse'; window.AddressParse = Parse; Parse.Utils = Utils; Parse.AREA = AREA; Parse.ParseAddress = ParseAddress;
def calculate_final_price(num, tax, formato): resp = num - (num * tax / 100) return moeda(resp) if formato else resp def moeda(num, cifrao='R$'): return f'{cifrao}{num:>.2f}'.replace('.', ',')
<reponame>ElianeBriand/SMolDock var searchData= [ ['onlylocal',['OnlyLocal',['../class_smol_dock_1_1_heuristics_1_1_only_local.html',1,'SmolDock::Heuristics']]], ['optimizer',['Optimizer',['../class_smol_dock_1_1_optimizer_1_1_optimizer.html',1,'SmolDock::Optimizer']]] ];
<filename>drakebot.py import re import logging import slack # constants MENTION_REGEX = r"^.*<@(|[WU].+?)>\W?(.*)" # global variables Drakebot_ID = '' Token = '' Message_Function = None class drakebot: def __init__(self, token: str, message_function): if (token is None or token == ''): raise Exception('No value found for token!') if (not callable(message_function)): raise Exception('Function passed for "message_function" is not callable!') self.Token = token self.Message_Function = message_function try: # Get just the drakebot id web_client = slack.WebClient(self.Token, timeout=30) self.Drakebot_ID = web_client.api_call("auth.test")["user_id"] logging.debug(f'Drake Bot ID received: {self.Drakebot_ID}') except Exception as e: logging.critical(f"{e.__class__.__name__}: {e}\n\nConnection failed. Exception traceback printed above.") raise def start(self): try: logging.info('Starting Slack Bot RTM interface...') rtmclient = slack.RTMClient(token=self.Token) rtmclient.run_on(event='message')(self.handle_command) rtmclient.start() except Exception as e: logging.critical(f"{e.__class__.__name__}: {e}\n\nConnection failed. Exception traceback printed above.") raise def parse_direct_mention(self, message_text): """ Finds a direct mention (a mention that is at the beginning) in message text and returns the user ID which was mentioned. If there is no direct mention, returns None """ matches = re.search(MENTION_REGEX, message_text) # the first group contains the username, the second group contains the remaining message return (matches.group(1), matches.group(2).strip()) if matches else (None, None) def handle_command(self, **payload): response = '' data = payload['data'] if (not 'subtype' in data): user_id, message = self.parse_direct_mention(data['text']) if user_id == self.Drakebot_ID: channel_id = data['channel'] # thread_ts = data['ts'] # user = data['user'] webclient = payload['web_client'] response = self.Message_Function(message) webclient.chat_postMessage( channel=channel_id ,text = response # ,thread_ts = thread_ts ) else: logging.debug('This message was not inteded for the bot. Ignore this.') if __name__ == "__main__": logging.critical('Please load this script as a class.')
module.exports = messagesByMonth = (thread) => { let dict = {}; for (message of thread.messages) { const d = new Date(message.date); const date = `'${d.getFullYear().toString().substr(2)}-${((d.getMonth() + 1).toString().length === 1 ? '0' : '') + (d.getMonth() + 1)}`; if (!dict[date]) { dict[date] = {}; dict[date]['date'] = date; } if (!dict[date][message['sender']]) { dict[date][message['sender']] = 0; } ++dict[date][message['sender']]; } return Object.values(dict); }
#!/bin/bash -x ##################################################################### # SUMMARY: Train a quantized marian model # AUTHOR: afaji # TAGS: clip-norm ##################################################################### # Exit on error set -e PREFIX=quantized # Remove old artifacts and create working directory rm -rf train $PREFIX.{log,out,diff} mkdir -p train # Train an 8-bits model $MRT_MARIAN/marian \ --no-shuffle --seed 1111 --dim-emb 32 --dim-rnn 64 --mini-batch 32 --maxi-batch 1 --maxi-batch-sort none --learn-rate 0.1 --optimizer sgd --clip-norm 1 \ -m train/model.npz -t $MRT_DATA/europarl.de-en/corpus.bpe.{en,de} -v train/vocab.en.yml train/vocab.de.yml \ --cost-type cross-entropy --sync-sgd --after-batches 100 --disp-freq 10 --quantize-bits 8 \ --log $PREFIX.log # Check if files exist test -e train/model.npz test -e $PREFIX.log # Compare the current output with the expected output cat $PREFIX.log | $MRT_TOOLS/extract-costs.sh > $PREFIX.out $MRT_TOOLS/diff-nums.py $PREFIX.out $PREFIX.expected -o $PREFIX.diff # make sure that the resulting model has no more than 256 different values (i.e. quantized) $MRT_TOOLS/check-model-unique-vals.py train/model.npz -b 8 # Exit with success code exit 0
#! /bin/sh python pa4.py train.csv test.csv echo "finish"
#!/bin/bash #used to differentiate our output from other. Other output is still shown # in the case of errors COLOR='\033[01;33m' # Perhaps overkill, but preps the local environment for snappy testing printhelp() { echo -e "${COLOR}Paradrop build tools." && tput sgr0 echo -e "${COLOR}Please use Ubuntu 16.04+ as the development machine!\n" && tput sgr0 echo -e "This tool installs all needed dependencies in a local virtual environment and set up Snappy development\n" echo "Usage:" echo -e " setup\t\t prepares environment for development" echo -e " run\t\t run paradrop locally" echo -e " build\t\t build snap" echo -e " image\t\t build disk image" echo -e " test\t\t run unit tests" echo -e " docs\t\t rebuilds sphinx docs for readthedocs" echo -e " version [version]\t\t get or set Paradrop version" echo -e " release <version>\t\t prepare a version for release" exit } version() { if [ -n "$1" ]; then majmin=$(echo $1 | grep -oE "[0-9]+\.[0-9]+") sed -i "s/^version:.*/version: $1/" -i paradrop/snap/snapcraft.yaml sed -i "s/version=.*,/version='$1',/" -i paradrop/daemon/setup.py sed -i "s/version=.*,/version='$1',/" -i tools/pdtools/setup.py sed -i "s/version =.*/version = \"$majmin\"/" -i docs/conf.py sed -i "s/release =.*/release = \"$1\"/" -i docs/conf.py else grep -oP "(?<=version: )\d+\.\d+\.\d+" paradrop/snap/snapcraft.yaml fi } release() { if [ -z "$1" ]; then printhelp exit 1 fi git diff-index --quiet HEAD -- if [ $? -ne 0 ]; then echo "The working tree is not clean." echo "You should commit your changes or clean up before releasing." exit 1 fi branch=$(git rev-parse --abbrev-ref HEAD) if [ "$branch" != "master" ]; then echo "Not on the master branch." exit 1 fi version $1 git add --update git commit -m "Release version $1" git tag -a "v$1" -m "Release version $1" } activate_virtual_env() { . buildenv/env/bin/activate } deactivate_virtual_env() { deactivate } setup() { echo -e "${COLOR}Setting up virtualenv" && tput sgr0 if [ ! -f /usr/local/bin/virtualenv ] && [ ! -f /usr/bin/virtualenv ]; then sudo apt-get install python-setuptools python-dev build-essential libcurl4-gnutls-dev libghc-gnutls-dev libffi-dev libssl-dev virtualenv sudo easy_install pip fi if ! type "snapcraft" > /dev/null; then echo -e "${COLOR} Installing snappy tools" && tput sgr0 sudo apt-get update sudo apt-get install snapcraft fi echo -e "${COLOR}Snappy development tools installed" && tput sgr0 virtualenv buildenv/env activate_virtual_env pip install -r requirements.txt deactivate_virtual_env } build() { # Set the build number if this is a CI build. if [ -n "$CI_JOB_ID" ]; then semver=$(version) version $semver+$CI_JOB_ID fi (cd paradrop; snapcraft clean; snapcraft) } image() { image="paradrop-amd64.img" if [ -e "$image" ]; then echo "Output file $image already exists." echo "Remove it before building a new image." exit 1 fi echo "Select the paradrop-daemon snap to use (1 for snap store):" select pdsnap in paradrop-daemon paradrop/*.snap; do break done echo "Select the channel to track for paradrop-daemon:" select channel in stable candidate beta edge; do break done echo "Select the channel to track for all other snaps (recommended: stable):" select other_channel in stable candidate beta edge; do break done sudo ubuntu-image -o $image \ --channel "$other_channel" \ --extra-snaps "$pdsnap" \ --image-size 4G \ assertions/paradrop-amd64.model # The ubuntu-image command only takes a single channel argument and applies # it to all snaps. If we we want to use a different channel for # paradrop-daemon, we can mount the image and modify seed.yaml. if [ "$channel" != "$other_channel" ]; then sudo mkdir -p /mnt/paradrop-amd64 sudo mount -o loop,offset=$((106496*512)) $image /mnt/paradrop-amd64 sudo python utils/set_seed_channel.py /mnt/paradrop-amd64/system-data/var/lib/snapd/seed/seed.yaml paradrop-daemon $channel sudo umount /mnt/paradrop-amd64 sudo rmdir /mnt/paradrop-amd64 fi echo "Created image $image, compressing..." xz --force --keep --compress $image } test() { activate_virtual_env nosetests -v deactivate_virtual_env } docs() { activate_virtual_env rm docs/requirements.txt pip install -e ./paradrop/daemon pip freeze | grep -v 'paradrop' > docs/requirements.txt deactivate_virtual_env } clean() { echo "Cleaning build directories" (cd paradrop; snapcraft clean) find . -name "*.pyc" | xargs rm -f } run() { echo -e "${COLOR}Starting Paradrop" && tput sgr0 activate_virtual_env pip install -e ./paradrop/daemon sudo buildenv/env/bin/paradrop -m local -p $PWD/paradrop/localweb/www deactivate_virtual_env } #Show help if no args passed if [ $# -lt 1 ] then printhelp fi ### # Call Operations ### case "$1" in "help") printhelp;; "--help") printhelp;; "setup") setup;; "test") test;; "build") build;; "image") image;; "clean") clean;; "run") run;; "docs") docs;; "version") version $2;; "release") release $2;; *) echo "Unknown input $1" ;; esac
/* * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the * License for the specific language governing rights and limitations * under the License. * * The Original Code is "Simplenlg". * * The Initial Developer of the Original Code is <NAME>, <NAME> and <NAME>. * Portions created by <NAME>, <NAME> and <NAME> are Copyright (C) 2010-11 The University of Aberdeen. All Rights Reserved. * * Contributor(s): <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>. */ package simplenlg.features.french; /** * Extension of the internal features constants for French. * * @author vaudrypl * */ public abstract class FrenchFeature { /** * <p> * This feature represents the word used as a negation auxiliary. * If this feature is not specified, the adverb "pas" will be used * by default. * </p> * <table border="1"> * <tr> * <td><b>Feature name</b></td> * <td><em>negation_auxiliary</em></td> * </tr> * <tr> * <td><b>Expected type</b></td> * <td>A <code>WordElement</code> or <code>String</code>. * <code>WordElement</code> is prefered.</td> * </tr> * <tr> * <td><b>Created by</b></td> * <td><code>The user.</td> * </tr> * <tr> * <td><b>Used by</b></td> * <td>The syntax verb phrase helper.</td> * </tr> * <tr> * <td><b>Applies to</b></td> * <td>clauses and verb phrases.</td> * </tr> * <tr> * <td><b>Default</b></td> * <td><code>null</code></td> * </tr> * </table> */ public static final String NEGATION_AUXILIARY = "negation_auxiliary"; /** * <p> * This feature indicates the phrase that should be replaced by * a relative pronoun, if any. If the discourse function of the phrase is * subject, direct object or indirect object, the other phrases of the same * function won't be realised. * </p> * <table border="1"> * <tr> * <td><b>Feature name</b></td> * <td><em>relative_phrase</em></td> * </tr> * <tr> * <td><b>Expected type</b></td> * <td><code>PhraseElement</code></td> * </tr> * <tr> * <td><b>Created by</b></td> * <td>The user must set this value.</td> * </tr> * <tr> * <td><b>Used by</b></td> * <td>The syntax processor uses this feature to correctly structure * relative clauses.</td> * </tr> * <tr> * <td><b>Applies to</b></td> * <td>Clauses only.</td> * </tr> * <tr> * <td><b>Default</b></td> * <td><code>null</code>.</td> * </tr> * </table> */ public static final String RELATIVE_PHRASE = "relative_phrase"; }
<reponame>krrrr38/mackerel-client-scala package com.krrrr38.mackerel4s package api import com.krrrr38.mackerel4s.model.Types.ServiceName import com.krrrr38.mackerel4s.model.ServiceMetric import com.krrrr38.mackerel4s.builder.PostServiceTsdbBuilder trait ServiceMetricAPI { self: MackerelClientBase => /** * post service metrics. * * @see [[http://help-ja.mackerel.io/entry/spec/api/v0#service-metric-value-post]] * @param serviceName * @param metrics * @return */ @deprecated("Use method postServiceMetrics instead.", "0.4.0") def postServiceMetric(serviceName: ServiceName, metrics: Seq[ServiceMetric]) = postServiceMetrics(serviceName, metrics) /** * post service metrics. * * @see [[http://help-ja.mackerel.io/entry/spec/api/v0#service-metric-value-post]] * @param serviceName * @param metrics * @return */ def postServiceMetrics(serviceName: ServiceName, metrics: Seq[ServiceMetric]) = PostServiceTsdbBuilder(client, serviceName, metrics) }
<gh_stars>10-100 import { InstanceContextAfterBuildTaskInterface } from './instance-context-after-build-task.interface'; import { InheritedEnvVariableInterface } from '../../command/after-build/inherited-env-variable.interface'; import { CustomEnvVariableInterface } from '../../command/after-build/custom-env-variable.interface'; export interface InstanceContextExecuteServiceCmdInterface extends InstanceContextAfterBuildTaskInterface { readonly customEnvVariables: CustomEnvVariableInterface[]; readonly inheritedEnvVariables: InheritedEnvVariableInterface[]; readonly serviceId: string; readonly command: string[]; readonly absoluteGuestInstancePath: string; }
<gh_stars>0 'use strict'; // Wait for the html content to load and then start window.onload = function () { // Get markdown and html id tags var markdown = document.getElementById("markdown"); var sowhat = document.getElementById("sowhat"); // Set option for block level renderer in marked.js // Convert hr (---) into div in the html var myRenderer = new marked.Renderer(); myRenderer.hr = function () { return '</div> <div>'; } // Get markdown from textarea, convert to html, and wrap in a div function Convert(input, output) { console.log(input.value); this.update = function () { output.innerHTML = '<div>' + marked(input.value, {renderer: myRenderer}) + '</div>'; console.log(output.innerHTML); }; input.editor = this; this.update(); } new Convert(markdown, sowhat); // Update the slide show with the editor // SETUP & SHOW - Show the current slide // Get an array of all the div (slides) to show. var slides = sowhat.getElementsByTagName('div'); // Set the show slide number to zero. var onSlide = 0; // if there are no slides, then exit the function. if (!slides) return; // Show the slide number n. function show(n) { // Set show slide and onSlide number to n. onSlide = n; var showSlide = slides[n]; // Make all the div / slides disappear for (var i = 0; i < slides.length; i++){ slides[i].style.display = 'none'; } // Show the current slide. showSlide.style.display = 'inline'; // Update the hash on the url if (window.location.hash !== onSlide) { window.location.hash = onSlide; } } // CONTROLS - Move the Slides // On click, show the next slide. Cycle back to start. sowhat.onclick = function () { onSlide = (onSlide + 1) % slides.length; show(onSlide); }; // Move to previous slide function prev () { onSlide = onSlide - 1; show(Math.max(onSlide, 0)); } // Move to next slide function next () { onSlide = onSlide + 1; show(Math.min(onSlide, slides.length - 1)); } // On key up or left, go previous. On key down or right, go next sowhat.onkeydown = function(key) { if (key.which === 39 || key.which === 40) next(); if (key.which === 37 || key.which === 38) prev(); }; // Prevent entire screen scrolling on touch device sowhat.ontouchmove = function(touch) { touch.preventDefault(); }; // Touch control based on start and end touch x coordinates sowhat.ontouchstart = function(touch) { var xStartCoordinate = touch.changedTouches[0].pageX; sowhat.ontouchend = function(touch) { var xEndCoordinate = touch.changedTouches[0].pageX; if (xEndCoordinate - xStartCoordinate < 0) next(); if (xEndCoordinate - xStartCoordinate > 0) prev(); }; }; // HASH - Show hash in url to navigate through the url bar. // Get the current hash for the url // Minimum 0, Maximum is total no. of slides - 1 // window.location.hash gives you the hash e.g. #3 // .substring(1) gives you e.g. only 3 function get_hash() { return Math.max( Math.min( slides.length - 1, parseInt(window.location.hash.substring(1), 10) ), 0 ); } // If no hash exists, then set it now. if (window.location.hash) onSlide = get_hash() || onSlide; // If hash changes in the url, then change the slide window.onhashchange = function() { var currentHash = get_hash(); if (currentHash !== onSlide) show(currentHash); }; // Show the current slide. show(onSlide); };
#!/bin/bash echo "__BHARVI__ Reading sound : " $1 mplayer $1
import analyticsWrapper from 'helpers/analytics/analyticsWrapper'; export default function gaWrapper(...args) { analyticsWrapper('gaAndGrx', ...args); }
#!/bin/bash export PATH=$PATH:/home/ubuntu/.rvm/rubies/ruby-2.7.1/bin/ #LOCALHOST APP_DIR="/apps/opendsa-lti/" #EFS_DIR="/var/tmp/credentials" RAILS_ENV='development' PORT="3000" # Change file permissions find ${APP_DIR} -type d -exec chmod 2775 {} \; find ${APP_DIR} -type f -exec chmod 0644 {} \; #Map gemset file cd "${APP_DIR}" rvm gemset use opendsa-6.0.3 ENVIRONMENT=$RAILS_ENV ERROR_FOUND=false; # Install Required gems cd "${APP_DIR}" bundle install which bundle >> /apps/opendsa-lti/log/development.log 2>&1 bundle version >> /apps/opendsa-lti/log/development.log 2>&1 # Create Soft link ln -s /apps/opendsa /apps/opendsa-lti/public/OpenDSA # Copy required files cp /apps/config/database.yml /apps/opendsa-lti/config/database.yml cp /apps/config/development.rb /apps/opendsa-lti/config/environments/development.rb cp /apps/opendsa-lti/postprocessor.py /apps/opendsa-lti/public/OpenDSA/tools/postprocessor.py if [[ "${ERROR_FOUND}" == true ]]; then exit 1; fi; cd "${APP_DIR}" echo "Start rake:work in the background - Executes delayed_jobs:" # Kill running process ps aux |grep "rake jobs:work" |grep -v grep| awk '{print $2 }'|xargs -I{} kill {} nohup bundle exec rake jobs:work >> /apps/opendsa-lti/log/development.log 2>&1 & echo "RAILS_ENV=$RAILS_ENV bundle exec thin start -p ${PORT}" # Kill running process lsof -t -i tcp:${PORT} | xargs kill -9 RAILS_ENV=${ENVIRONMENT} bundle exec thin start -p ${PORT} -d >> /apps/opendsa-lti/log/development.log 2>&1
package com.crowdin.client.core.http; import com.crowdin.client.core.model.Format; import com.crowdin.client.framework.TestHttpClient; import org.junit.jupiter.api.Test; import java.util.LinkedHashMap; import java.util.Map; import java.util.Optional; import static org.junit.jupiter.api.Assertions.assertEquals; public class HttpClientTest { @Test public void appendUrlParamsTest() { String url = "test.com"; Map<String, Optional<Object>> urlParams = new LinkedHashMap<>(); urlParams.put("a", Optional.empty()); urlParams.put("b", Optional.of(4)); urlParams.put("c", Optional.of(Format.TBX)); HttpClient client = new TestHttpClient(); String urlWithParams = client.appendUrlParams(url, urlParams); assertEquals(urlWithParams, url + "?b=" + 4 + "&c=" + Format.TBX.to(Format.TBX)); } }
#!/bin/bash echo Who are you? read who #who="World" echo Hello, $who!
#!/usr/bin/env bash set -e python3 -m venv venv source venv/bin/activate pip install -r requirements.txt
<gh_stars>0 package com.jf.system.quartz.jobs; import com.jf.service.JobService; import org.quartz.DisallowConcurrentExecution; import org.quartz.JobExecutionContext; import org.quartz.JobExecutionException; import org.springframework.scheduling.quartz.QuartzJobBean; import javax.annotation.Resource; /** * Created with IntelliJ IDEA. * Description: * User: admin * Date: 2018-03-02 * Time: 16:09 */ @DisallowConcurrentExecution public class Job1 extends QuartzJobBean { @Resource private JobService jobService; @Override protected void executeInternal(JobExecutionContext jobExecutionContext) throws JobExecutionException { jobService.test("###### Job1 ######"); } }
<reponame>paulushub/SandAssists #include "hunspell/hunspell.hxx" #include <windows.h> #include <locale.h> #include <mbctype.h> #include "NHunspellExtensions.h" #include "EncodingToCodePage.h" #define DLLEXPORT extern "C" __declspec( dllexport ) class NHunspell: public Hunspell { // The methods aren't multi threaded, reentrant or whatever so a encapsulated buffer can be used for performance reasons void * marshalBuffer; size_t marshalBufferSize; void * wordBuffer; size_t wordBufferSize; void * word2Buffer; size_t word2BufferSize; void * affixBuffer; size_t affixBufferSize; public: UINT CodePage; inline NHunspell(const char *affpath, const char *dpath, const char * key = 0) : Hunspell(affpath,dpath,key) { marshalBuffer = 0; marshalBufferSize = 0; wordBuffer = 0; wordBufferSize = 0; word2Buffer = 0; word2BufferSize = 0; affixBuffer = 0; affixBufferSize = 0; char * encoding = get_dic_encoding(); CodePage = EncodingToCodePage( encoding ); } inline ~NHunspell() { if( marshalBuffer != 0 ) free( marshalBuffer ); if( wordBuffer != 0 ) free( wordBuffer ); if( word2Buffer != 0 ) free( word2Buffer ); if( affixBuffer != 0 ) free( affixBuffer ); } // Buffer for marshaling string lists back to .NET void * GetMarshalBuffer(size_t size) { if(size < marshalBufferSize ) return marshalBuffer; if( marshalBufferSize == 0 ) { size += 128; marshalBuffer = malloc( size ); } else { size += 256; marshalBuffer = realloc(marshalBuffer, size ); } marshalBufferSize = size; return marshalBuffer; } // Buffer for the mutibyte representation of a word void * GetWordBuffer(size_t size) { if(size < wordBufferSize ) return wordBuffer; if( wordBufferSize == 0 ) { size += 32; wordBuffer = malloc( size ); } else { size += 64; wordBuffer = realloc(wordBuffer, size ); } wordBufferSize = size; return wordBuffer; } // Buffer for the mutibyte representation of a word void * GetWord2Buffer(size_t size) { if(size < word2BufferSize ) return word2Buffer; if( word2BufferSize == 0 ) { size += 32; word2Buffer = malloc( size ); } else { size += 64; word2Buffer = realloc(wordBuffer, size ); } word2BufferSize = size; return word2Buffer; } inline char * GetWordBuffer( wchar_t * unicodeString ) { int buffersize = WideCharToMultiByte(CodePage,0,unicodeString,-1,0,0,0,0); char * buffer = (char *) GetWordBuffer( buffersize ); WideCharToMultiByte(CodePage,0,unicodeString,-1,buffer,buffersize,0,0); return buffer; } inline char * GetWord2Buffer( wchar_t * unicodeString ) { int buffersize = WideCharToMultiByte(CodePage,0,unicodeString,-1,0,0,0,0); char * buffer = (char *) GetWord2Buffer( buffersize ); WideCharToMultiByte(CodePage,0,unicodeString,-1,buffer,buffersize,0,0); return buffer; } // Buffer for the mutibyte representation of an affix void * GetAffixBuffer(size_t size) { if(size < affixBufferSize ) return affixBuffer; if( affixBufferSize == 0 ) { size += 32; affixBuffer = malloc( size ); } else { size += 64; affixBuffer = realloc(affixBuffer, size ); } affixBufferSize = size; return affixBuffer; } inline char * GetAffixBuffer( wchar_t * unicodeString ) { int buffersize = WideCharToMultiByte(CodePage,0,unicodeString,-1,0,0,0,0); char * buffer = (char *) GetAffixBuffer( buffersize ); WideCharToMultiByte(CodePage,0,unicodeString,-1,buffer,buffersize,0,0); return buffer; } }; inline char * AllocMultiByteBuffer( wchar_t * unicodeString ) { int buffersize = WideCharToMultiByte(CP_UTF8,0,unicodeString,-1,0,0,0,0); char * buffer = (char *) malloc( buffersize ); WideCharToMultiByte(CP_UTF8,0,unicodeString,-1,buffer,buffersize,0,0); return buffer; } /************************* Export Functions **************************************************************/ DLLEXPORT NHunspell * HunspellInit(void * affixBuffer, size_t affixBufferSize, void * dictionaryBuffer, size_t dictionaryBufferSize, wchar_t * key) { char * key_buffer = 0; if( key != 0 ) key_buffer = AllocMultiByteBuffer(key); MemoryBufferInformation affixBufferInfo; affixBufferInfo.magic = magicConstant; affixBufferInfo.buffer = affixBuffer; affixBufferInfo.bufferSize = affixBufferSize; MemoryBufferInformation dictionaryBufferInfo; dictionaryBufferInfo.magic = magicConstant; dictionaryBufferInfo.buffer = dictionaryBuffer; dictionaryBufferInfo.bufferSize = dictionaryBufferSize; NHunspell * result = new NHunspell((const char *) &affixBufferInfo, (const char *) &dictionaryBufferInfo,key_buffer); if( key_buffer != 0 ) free( key_buffer ); return result; } DLLEXPORT void HunspellFree(NHunspell * handle ) { delete handle; } DLLEXPORT bool HunspellAdd(NHunspell * handle, wchar_t * word ) { char * word_buffer = handle->GetWordBuffer(word); int success = handle->add(word_buffer); return success != 0; } DLLEXPORT bool HunspellAddWithAffix(NHunspell * handle, wchar_t * word, wchar_t * example ) { char * word_buffer = ((NHunspell *) handle)->GetWordBuffer(word); char * example_buffer = ((NHunspell *) handle)->GetWord2Buffer(example); bool success = handle->add_with_affix(word_buffer,example_buffer) != 0; return success; } DLLEXPORT bool HunspellSpell(NHunspell * handle, wchar_t * word ) { char * word_buffer = ((NHunspell *) handle)->GetWordBuffer(word); bool correct = ((NHunspell *) handle)->spell(word_buffer) != 0; return correct; } DLLEXPORT void * HunspellSuggest(NHunspell * handle, wchar_t * word ) { char * word_buffer = ((NHunspell *) handle)->GetWordBuffer(word); char ** wordList; int wordCount = ((NHunspell *) handle)->suggest(&wordList, word_buffer); // Cacculation of the Marshalling Buffer. // Layout: {Pointers- zero terminated}{Wide Strings - zero terminated} size_t bufferSize = (wordCount + 1) * sizeof (wchar_t **); for( int i = 0; i < wordCount; ++ i ) bufferSize += MultiByteToWideChar(handle->CodePage,0,wordList[i],-1,0,0) * sizeof( wchar_t); BYTE * marshalBuffer = (BYTE *) ((NHunspell *) handle)->GetMarshalBuffer( bufferSize ); wchar_t ** pointer = (wchar_t ** ) marshalBuffer; wchar_t * buffer = (wchar_t * ) (marshalBuffer + (wordCount + 1) * sizeof (wchar_t **)); for( int i = 0; i < wordCount; ++ i ) { *pointer = buffer; size_t wcsSize = MultiByteToWideChar(handle->CodePage,0,wordList[i],-1,0,0); MultiByteToWideChar(handle->CodePage,0,wordList[i],-1,buffer,wcsSize); // Prepare pointers for the next string buffer += wcsSize; ++pointer; } // Zero terminate the pointer list *pointer = 0; ((NHunspell *) handle)->free_list(&wordList, wordCount); return marshalBuffer; } DLLEXPORT void * HunspellAnalyze(NHunspell * handle, wchar_t * word ) { char * word_buffer = ((NHunspell *) handle)->GetWordBuffer(word); char ** morphList; int morphCount = ((NHunspell *) handle)->analyze(&morphList, word_buffer); // Cacculation of the Marshalling Buffer. Layout: {Pointers- zero terminated}{Wide Strings - zero terminated} size_t bufferSize = (morphCount + 1) * sizeof (wchar_t **); for( int i = 0; i < morphCount; ++ i ) bufferSize += MultiByteToWideChar(handle->CodePage,0,morphList[i],-1,0,0) * sizeof( wchar_t); BYTE * marshalBuffer = (BYTE *) ((NHunspell *) handle)->GetMarshalBuffer( bufferSize ); wchar_t ** pointer = (wchar_t ** ) marshalBuffer; wchar_t * buffer = (wchar_t * ) (marshalBuffer + (morphCount + 1) * sizeof (wchar_t **)); for( int i = 0; i < morphCount; ++ i ) { *pointer = buffer; size_t wcsSize = MultiByteToWideChar(handle->CodePage,0,morphList[i],-1,0,0); MultiByteToWideChar(handle->CodePage,0,morphList[i],-1,buffer,wcsSize); // Prepare pointers for the next string buffer += wcsSize; ++pointer; } // Zero terminate the pointer list *pointer = 0; ((NHunspell *) handle)->free_list(&morphList, morphCount); return marshalBuffer; } DLLEXPORT void * HunspellStem(NHunspell * handle, wchar_t * word ) { char * word_buffer = ((NHunspell *) handle)->GetWordBuffer(word); char ** stemList; int stemCount = ((NHunspell *) handle)->stem(&stemList, word_buffer); // Cacculation of the Marshalling Buffer. Layout: {Pointers- zero terminated}{Wide Strings - zero terminated} size_t bufferSize = (stemCount + 1) * sizeof (wchar_t **); for( int i = 0; i < stemCount; ++ i ) bufferSize += MultiByteToWideChar(handle->CodePage,0,stemList[i],-1,0,0) * sizeof( wchar_t); BYTE * marshalBuffer = (BYTE *) ((NHunspell *) handle)->GetMarshalBuffer( bufferSize ); wchar_t ** pointer = (wchar_t ** ) marshalBuffer; wchar_t * buffer = (wchar_t * ) (marshalBuffer + (stemCount + 1) * sizeof (wchar_t **)); for( int i = 0; i < stemCount; ++ i ) { *pointer = buffer; size_t wcsSize = MultiByteToWideChar(handle->CodePage,0,stemList[i],-1,0,0); MultiByteToWideChar(handle->CodePage,0,stemList[i],-1,buffer,wcsSize); // Prepare pointers for the next string buffer += wcsSize; ++pointer; } // Zero terminate the pointer list *pointer = 0; ((NHunspell *) handle)->free_list(&stemList, stemCount); return marshalBuffer; } DLLEXPORT void * HunspellGenerate(NHunspell * handle, wchar_t * word, wchar_t * word2 ) { char * word_buffer = ((NHunspell *) handle)->GetWordBuffer(word); char * word2_buffer = ((NHunspell *) handle)->GetWord2Buffer(word2); char ** stemList; int stemCount = ((NHunspell *) handle)->generate(&stemList, word_buffer, word2_buffer); // Cacculation of the Marshalling Buffer. Layout: {Pointers- zero terminated}{Wide Strings - zero terminated} size_t bufferSize = (stemCount + 1) * sizeof (wchar_t **); for( int i = 0; i < stemCount; ++ i ) bufferSize += MultiByteToWideChar(handle->CodePage,0,stemList[i],-1,0,0) * sizeof( wchar_t); BYTE * marshalBuffer = (BYTE *) ((NHunspell *) handle)->GetMarshalBuffer( bufferSize ); wchar_t ** pointer = (wchar_t ** ) marshalBuffer; wchar_t * buffer = (wchar_t * ) (marshalBuffer + (stemCount + 1) * sizeof (wchar_t **)); for( int i = 0; i < stemCount; ++ i ) { *pointer = buffer; size_t wcsSize = MultiByteToWideChar(handle->CodePage,0,stemList[i],-1,0,0); MultiByteToWideChar(handle->CodePage,0,stemList[i],-1,buffer,wcsSize); // Prepare pointers for the next string buffer += wcsSize; ++pointer; } // Zero terminate the pointer list *pointer = 0; ((NHunspell *) handle)->free_list(&stemList, stemCount); return marshalBuffer; }
/** * Copyright (c) 2017-present, Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #define DEBUG_TYPE "opencl" #include "OpenCL.h" #include "glow/Graph/Graph.h" #include "glow/Graph/Nodes.h" #include "glow/IR/Instrs.h" #include "llvm/ADT/SmallVector.h" #include "llvm/Support/Casting.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/Debug.h" #include "llvm/Support/Format.h" #include "llvm/Support/raw_ostream.h" using namespace glow; using llvm::format; using llvm::cast; using llvm::dyn_cast; using llvm::isa; typedef uint32_t cl_size_t; // This defines the string "SHADER_CODE". #include "kernels.cl" namespace { llvm::cl::OptionCategory OpenCLBackendCat("Glow OpenCL Backend Options"); static llvm::cl::opt<unsigned> deviceId("device", llvm::cl::desc("OpenCL device to be used"), llvm::cl::init(0), llvm::cl::cat(OpenCLBackendCat)); static llvm::cl::opt<bool> doProfile("opencl-profile", llvm::cl::desc("Profile OpenCL kernels"), llvm::cl::init(false), llvm::cl::cat(OpenCLBackendCat)); } // namespace Backend *glow::createOCLBackend(IRFunction *F) { return new OCLBackend(F); } using Kind = Kinded::Kind; using kernelSrcEnum = struct { Kind kind; const char *funcName; }; static void dumpCompileLog(cl_device_id dev, cl_program prog) { #ifndef NDEBUG // Determine the size of the log. size_t logSize; clGetProgramBuildInfo(prog, dev, CL_PROGRAM_BUILD_LOG, 0, nullptr, &logSize); // Allocate memory for the log. auto *log = (char *)malloc(logSize); // Get the log. clGetProgramBuildInfo(prog, dev, CL_PROGRAM_BUILD_LOG, logSize, log, nullptr); // Print the log. llvm::outs() << log << "\n"; free(log); #endif } OCLBackend::OCLBackend(IRFunction *F) : F_(F), allocator_(0xFFFFFFFF) { cl_uint num{0}; cl_int err = clGetDeviceIDs(nullptr, CL_DEVICE_TYPE_ALL, 0, nullptr, &num); GLOW_ASSERT(err == CL_SUCCESS && "clGetDeviceIDs Failed."); GLOW_ASSERT(num > deviceId && "Should have at least one GPU for running OpenCL"); cl_device_id devices[num]; err = clGetDeviceIDs(nullptr, CL_DEVICE_TYPE_ALL, num, devices, nullptr); GLOW_ASSERT(err == CL_SUCCESS && "clGetDeviceIDs Failed."); deviceId_ = devices[deviceId]; context_ = clCreateContext(nullptr, 1, &deviceId_, nullptr, nullptr, nullptr); GLOW_ASSERT(context_ && "clCreateContext Failed."); commands_ = clCreateCommandQueue( context_, deviceId_, (doProfile) ? CL_QUEUE_PROFILING_ENABLE : 0, &err); GLOW_ASSERT(commands_ && "clCreateCommandQueue Failed."); err = CL_SUCCESS; /// Create the program from the source. createProgram(SHADER_CODE, {}, commands_); } OCLBackend::~OCLBackend() { for (auto &kv : programsCache_) { auto prog = kv.second; clReleaseProgram(prog); } clReleaseCommandQueue(commands_); clReleaseContext(context_); if (deviceBuffer_) { freeDeviceBuffer(deviceBuffer_); deviceBuffer_ = nullptr; } clear(); } cl_kernel OCLBackend::createKernel(const std::string &name, cl_program program) { cl_int err = CL_SUCCESS; cl_kernel kernel = nullptr; if (program) { cl_kernel kernel = clCreateKernel(program, name.c_str(), &err); GLOW_ASSERT((kernel && err == CL_SUCCESS) && "clCreateKernel Failed."); return kernel; } // Inspect all programs. for (auto &kv : programsCache_) { auto prog = kv.second; cl_kernel kernel = clCreateKernel(prog, name.c_str(), &err); if (err == CL_SUCCESS) { return kernel; } } GLOW_ASSERT(kernel && "clCreateKernel Failed."); return kernel; } cl_program OCLBackend::createProgram(const std::string &source, const std::vector<std::string> &options, cl_command_queue queue) { const char *src = source.c_str(); cl_context ctx; cl_int err = clGetCommandQueueInfo(queue, CL_QUEUE_CONTEXT, sizeof(ctx), &ctx, nullptr); GLOW_ASSERT(err == CL_SUCCESS && "clGetCommandQueueInfo Failed."); cl_device_id deviceId; err = clGetCommandQueueInfo(queue, CL_QUEUE_DEVICE, sizeof(deviceId), &deviceId, nullptr); GLOW_ASSERT(err == CL_SUCCESS && "clGetCommandQueueInfo Failed."); // Check if this program was compiled with the same parameters for the // provided context and device. std::string combinedOptions; for (auto &opt : options) { combinedOptions.append(opt).append(" "); } ProgramKey key = std::make_tuple(source, combinedOptions, deviceId); cl_program &program = programsCache_[key]; if (program) { return program; } // Create a new compiled program. program = clCreateProgramWithSource(context_, 1, &src, nullptr, &err); GLOW_ASSERT(program && "clCreateProgramWithSource Failed."); err = clBuildProgram(program, 0, nullptr, nullptr, nullptr, nullptr); if (err) { dumpCompileLog(deviceId, program); } GLOW_ASSERT(err == CL_SUCCESS && "clBuildProgram Failed."); // Add this program to the program cache. return program; } template <class T> void setKernelArg(cl_kernel kernel, unsigned argIdx, T value) { cl_int err = clSetKernelArg(kernel, argIdx, sizeof(T), &value); GLOW_ASSERT(err == CL_SUCCESS && "Unable to set parameter"); } /// \returns the max local workgroup size for each dimension, under the /// opencl constraints, with the global workgroup sizes of \p global; void getMaxLocalWorkgroupSize(cl_kernel kernel, cl_device_id device, llvm::ArrayRef<size_t> global, llvm::MutableArrayRef<size_t> local) { // Figure out the max size of the workgroup. size_t L; auto err = clGetKernelWorkGroupInfo(kernel, device, CL_KERNEL_WORK_GROUP_SIZE, sizeof(L), &L, nullptr); size_t WIS[3]; clGetDeviceInfo(device, CL_DEVICE_MAX_WORK_ITEM_SIZES, sizeof(WIS), &WIS, nullptr); size_t WGS; clGetDeviceInfo(device, CL_DEVICE_MAX_WORK_GROUP_SIZE, sizeof(WGS), &WGS, nullptr); GLOW_ASSERT(err == CL_SUCCESS && "Error in clGetKernelWorkGroupInfo."); // The global workgroup size must be a multiple of the local workgroup size, // and less than the max size for the specific dimension. Also, the // multiplication of all dimensions (size of total local work) needs to be // less than WSG. In here we find the highest L that divides the global // workgroup size. This is our naive implementation of gcd, with the other // constraints: size_t totalWorkPrevDims = 1; for (int i = 0, e = global.size(); i < e; i++) { local[i] = L; while (global[i] % local[i] || L % local[i] || local[i] > WIS[i] || local[i] * totalWorkPrevDims > WGS) { local[i]--; } // Remember how much work we are doing in this dimension. Use it to make // sure that the next dimenstions don't exceed the total allowed workgroup // size. totalWorkPrevDims *= local[i]; } } /// Enqueue a \p kernel for execution on the command queue \p commands on a /// given \p device. The information about the launched kernel will be added to /// \p kernelLaunches list. void OCLBackend::enqueueKernel(cl_command_queue commands, cl_kernel kernel, cl_device_id device, llvm::ArrayRef<size_t> global, std::vector<KernelLaunch> &kernelLaunches) { llvm::SmallVector<size_t, 4> local(global.size(), 0); getMaxLocalWorkgroupSize(kernel, device, global, local); char kernelName[128]; size_t retSize; cl_int err = clGetKernelInfo(kernel, CL_KERNEL_FUNCTION_NAME, sizeof(kernelName), &kernelName, &retSize); GLOW_ASSERT(err == CL_SUCCESS && "Error in clGetKernelInfo."); cl_event event{nullptr}; err = clEnqueueNDRangeKernel(commands, kernel, global.size(), nullptr, &global[0], &local[0], 0, nullptr, doProfile ? &event : nullptr); GLOW_ASSERT(err == CL_SUCCESS && "Error in clEnqueueNDRangeKernel."); kernelLaunches.push_back(KernelLaunch(kernel, kernelName, event)); } /// Analyze and dump the collected profiling information about the execution of /// OpenCL kernels. static void dumpProfileInfo(const std::vector<KernelLaunch> &kernelLaunches) { if (!doProfile) return; cl_ulong total = 0; std::unordered_map<std::string, cl_ulong> kernelToDuration; for (auto &kl : kernelLaunches) { auto &event = kl.event_; clWaitForEvents(1, &event); auto name = kl.name_; assert(!name.empty() && "Kernel name cannot be empty"); cl_ulong time_start; cl_ulong time_end; clGetEventProfilingInfo(event, CL_PROFILING_COMMAND_START, sizeof(time_start), &time_start, NULL); clGetEventProfilingInfo(event, CL_PROFILING_COMMAND_END, sizeof(time_end), &time_end, NULL); // Duration (in nanoseconds). double duration = time_end - time_start; kernelToDuration[name] += duration; total += duration; llvm::outs() << "OpenCl execution time for a launch of kernel " << name << format(" is: %0.3f milliseconds\n", duration / 1000000.0); } llvm::outs() << format( "OpenCl total execution time is: %0.3f milliseconds \n", total / 1000000.0); // Build a sorted list of kernel durations. std::vector<std::pair<cl_ulong, std::string>> sortedKernelDurations; sortedKernelDurations.reserve(kernelToDuration.size()); for (auto kv : kernelToDuration) { sortedKernelDurations.push_back(std::make_pair(kv.second, kv.first)); } std::sort(sortedKernelDurations.begin(), sortedKernelDurations.end()); llvm::outs() << "\n\nSummary information per kernel:\n"; for (auto k : sortedKernelDurations) { llvm::outs() << "OpenCl total execution time for kernel " << k.second << format(" is: %0.3f milliseconds (%lu%%)\n", k.first / 1000000.0, (unsigned long)(k.first * 100 / total)); } } void OCLBackend::doForwardPass() { auto copiedToDeviceBytes = copyMutableWeightsToDevice(); (void)copiedToDeviceBytes; DEBUG(llvm::dbgs() << "Copied " << copiedToDeviceBytes << " bytes to OpenCL device\n"); for (auto &I : F_->getInstrs()) { // The kernels are named after the name of the instruction, plus the "W" // suffix to prevent name colissions for functions like 'tanh' that are also // a part of the OpenCL runtime. std::string kernelName = std::string(I->getKindName()) + "W"; // Skip memory allocation instructions as they are NOPs. if (isa<AllocActivationInst>(I) || isa<DeallocActivationInst>(I) || isa<TensorViewInst>(I)) { continue; } // Element-wise operations, except the copy instruction. if (I->isDataParallel() && !isa<CopyInst>(I)) { cl_kernel kernel = createKernel(kernelName); setKernelArg(kernel, 0, deviceBuffer_); unsigned numArgs = I->getNumOperands(); for (unsigned arg = 0, e = I->getNumOperands(); arg < e; arg++) { setKernelArg<cl_uint>(kernel, arg + 1, tensors_[I->getOperand(arg).first]); } if (auto *SI = dyn_cast<SplatInst>(I)) { // Pass the splat as a parameter. setKernelArg(kernel, numArgs + 1, SI->getValue()); } // Figure out how many element-wise elements are there to process: size_t global; if (I->isDataParallel()) { global = I->getOperand(0).first->getType()->size(); } else { GLOW_UNREACHABLE("Invalid instruction."); } enqueueKernel(commands_, kernel, deviceId_, {global}, kernelLaunches_); continue; } if (auto *SM = dyn_cast<SoftMaxInst>(I)) { // Implement Softmax by parallelizing the batch dimension. Each sample in // the batch is processed by a different parallel 'thread'. cl_kernel kernel = createKernel(kernelName); setKernelArg(kernel, 0, deviceBuffer_); unsigned numArgs = I->getNumOperands(); for (unsigned arg = 0; arg < numArgs; arg++) { setKernelArg<cl_uint>(kernel, arg + 1, tensors_[I->getOperand(arg).first]); } // This is the number of elements for each slice. There are N slices in // our batch. auto inputDims = SM->getSrc()->getType()->dims(); size_t numSlices = inputDims[0]; // Pass the slice size (size of each sample in the batch) as a parameter. setKernelArg<cl_uint>(kernel, numArgs + 1, flattenCdr(inputDims).second); enqueueKernel(commands_, kernel, deviceId_, {numSlices}, kernelLaunches_); continue; } if (auto *CI = dyn_cast<InsertTensorInst>(I)) { cl_kernel kernel = createKernel(kernelName); setKernelArg(kernel, 0, deviceBuffer_); unsigned numArgs = I->getNumOperands(); for (unsigned arg = 0; arg < numArgs; arg++) { setKernelArg<cl_uint>(kernel, arg + 1, tensors_[I->getOperand(arg).first]); } // Currently support tensors of 2 and 4 dimensions. // TODO: Handle other dimensions. const size_t numDimensions = CI->getDest()->getType()->dims().size(); ShapeNHWC odim = ShapeNHWC::empty(); ShapeNHWC idim = ShapeNHWC::empty(); ShapeNHWC offset = ShapeNHWC::empty(); if (numDimensions == 4) { odim = ShapeNHWC(CI->getDest()->getType()->dims()); idim = ShapeNHWC(CI->getSrc()->getType()->dims()); offset = ShapeNHWC(CI->getOffsets()); } else if (numDimensions == 2) { odim = ShapeNHWC::fromXY(CI->getDest()->getType()->dims()); idim = ShapeNHWC::fromXY(CI->getSrc()->getType()->dims()); offset = ShapeNHWC::fromXY(CI->getOffsets()); } else { assert(false && "Unsupported tensor dimension"); } setKernelArg(kernel, 3, odim); setKernelArg(kernel, 4, idim); setKernelArg(kernel, 5, offset); enqueueKernel(commands_, kernel, deviceId_, {idim.n}, kernelLaunches_); continue; } if (auto *BMM = dyn_cast<MatMulInst>(I)) { // This is a naive implementation that parallelizes using three dims: // batch, X and Y in the output filter. cl_kernel kernel = createKernel(kernelName); setKernelArg(kernel, 0, deviceBuffer_); unsigned numArgs = I->getNumOperands(); for (unsigned arg = 0; arg < numArgs; arg++) { setKernelArg<cl_uint>(kernel, arg + 1, tensors_[I->getOperand(arg).first]); } auto ddim = ShapeNHWC::fromXY(BMM->getDest()->getType()->dims()); auto ldim = ShapeNHWC::fromXY(BMM->getLHS()->getType()->dims()); auto rdim = ShapeNHWC::fromXY(BMM->getRHS()->getType()->dims()); setKernelArg(kernel, 4, ddim); setKernelArg(kernel, 5, ldim); setKernelArg(kernel, 6, rdim); // Use a 3D grid where the first dimension is the N and the second and // third dimensions are the X and Y in the output buffer. enqueueKernel(commands_, kernel, deviceId_, {ddim.n, ddim.h, ddim.w}, kernelLaunches_); continue; } if (auto *BA = dyn_cast<BatchedAddInst>(I)) { cl_kernel kernel = createKernel(kernelName); setKernelArg(kernel, 0, deviceBuffer_); unsigned numArgs = I->getNumOperands(); for (unsigned arg = 0; arg < numArgs; arg++) { setKernelArg<cl_uint>(kernel, arg + 1, tensors_[I->getOperand(arg).first]); } auto bdim = flattenCdr(BA->getBatch()->dims()); setKernelArg<cl_uint>(kernel, 4, bdim.first); setKernelArg<cl_uint>(kernel, 5, bdim.second); // Parallelize on each element in the slice. enqueueKernel(commands_, kernel, deviceId_, {bdim.second}, kernelLaunches_); continue; } if (auto *BRA = dyn_cast<BatchedReduceAddInst>(I)) { cl_kernel kernel = createKernel(kernelName); setKernelArg(kernel, 0, deviceBuffer_); unsigned numArgs = I->getNumOperands(); for (unsigned arg = 0; arg < numArgs; arg++) { setKernelArg<cl_uint>(kernel, arg + 1, tensors_[I->getOperand(arg).first]); } auto bdim = flattenCdr(BRA->getBatch()->dims()); setKernelArg<cl_uint>(kernel, 3, bdim.first); setKernelArg<cl_uint>(kernel, 4, bdim.second); // Parallelize on each element in the slice. enqueueKernel(commands_, kernel, deviceId_, {bdim.second}, kernelLaunches_); continue; } if (auto *CC = dyn_cast<ConvolutionInst>(I)) { // This is a naive implementation that parallelizes using three dims: // the X and the Y in the output filter. cl_kernel kernel = createKernel(kernelName); setKernelArg(kernel, 0, deviceBuffer_); unsigned numArgs = I->getNumOperands(); for (unsigned arg = 0; arg < numArgs; arg++) { setKernelArg<cl_uint>(kernel, arg + 1, tensors_[I->getOperand(arg).first]); } auto odim = ShapeNHWC(CC->getDest()->getType()->dims()); auto idim = ShapeNHWC(CC->getSrc()->getType()->dims()); setKernelArg<cl_uint>(kernel, 5, CC->getKernel()); setKernelArg<cl_uint>(kernel, 6, CC->getStride()); setKernelArg<cl_uint>(kernel, 7, CC->getPad()); setKernelArg(kernel, 8, odim); setKernelArg(kernel, 9, idim); setKernelArg(kernel, 10, ShapeNHWC(CC->getFilter()->getType()->dims())); // Use a 3D grid where the first dimension is the depth and the second // dimension is the slice index in the batch. enqueueKernel(commands_, kernel, deviceId_, {odim.h, odim.w, odim.c}, kernelLaunches_); continue; } if (auto *PM = dyn_cast<PoolMaxInst>(I)) { // This is a naive implementation that parallelizes using three dims: // the X and the Y in the output filter. cl_kernel kernel = createKernel(kernelName); setKernelArg(kernel, 0, deviceBuffer_); unsigned numArgs = I->getNumOperands(); for (unsigned arg = 0; arg < numArgs; arg++) { setKernelArg<cl_uint>(kernel, arg + 1, tensors_[I->getOperand(arg).first]); } auto odim = ShapeNHWC(PM->getDest()->getType()->dims()); auto idim = ShapeNHWC(PM->getSrc()->getType()->dims()); setKernelArg<cl_uint>(kernel, numArgs + 1, PM->getKernel()); setKernelArg<cl_uint>(kernel, numArgs + 2, PM->getStride()); setKernelArg<cl_uint>(kernel, numArgs + 3, PM->getPad()); setKernelArg(kernel, numArgs + 4, odim); setKernelArg(kernel, numArgs + 5, idim); enqueueKernel(commands_, kernel, deviceId_, {odim.h, odim.w, odim.c}, kernelLaunches_); continue; } if (auto *PM = dyn_cast<PoolMaxWithXYInst>(I)) { // This is a naive implementation that parallelizes using three dims: // the X and the Y in the output filter. cl_kernel kernel = createKernel(kernelName); setKernelArg(kernel, 0, deviceBuffer_); unsigned numArgs = I->getNumOperands(); for (unsigned arg = 0; arg < numArgs; arg++) { setKernelArg<cl_uint>(kernel, arg + 1, tensors_[I->getOperand(arg).first]); } auto odim = ShapeNHWC(PM->getDest()->getType()->dims()); auto idim = ShapeNHWC(PM->getSrc()->getType()->dims()); setKernelArg<size_t>(kernel, numArgs + 1, PM->getKernel()); setKernelArg<cl_uint>(kernel, numArgs + 2, PM->getStride()); setKernelArg<cl_uint>(kernel, numArgs + 3, PM->getPad()); setKernelArg(kernel, numArgs + 4, odim); setKernelArg(kernel, numArgs + 5, idim); enqueueKernel(commands_, kernel, deviceId_, {odim.h, odim.w, odim.c}, kernelLaunches_); continue; } if (auto *PA = dyn_cast<PoolAvgInst>(I)) { // This is a naive implementation that parallelizes using three dims: // the X and the Y in the output filter. cl_kernel kernel = createKernel(kernelName); setKernelArg(kernel, 0, deviceBuffer_); unsigned numArgs = I->getNumOperands(); for (unsigned arg = 0; arg < numArgs; arg++) { setKernelArg<cl_uint>(kernel, arg + 1, tensors_[I->getOperand(arg).first]); } auto odim = ShapeNHWC(PA->getDest()->getType()->dims()); auto idim = ShapeNHWC(PA->getSrc()->getType()->dims()); setKernelArg<cl_uint>(kernel, 3, PA->getKernel()); setKernelArg<cl_uint>(kernel, 4, PA->getStride()); setKernelArg<cl_uint>(kernel, 5, PA->getPad()); setKernelArg(kernel, 6, odim); setKernelArg(kernel, 7, idim); enqueueKernel(commands_, kernel, deviceId_, {odim.h, odim.w, odim.c}, kernelLaunches_); continue; } if (auto *TR = dyn_cast<TransposeInst>(I)) { // This is a naive implementation that parallelizes using one dimension, // the N (batch size). GLOW_ASSERT(TR->getShuffle().size() <= 4 && "This code supports only 4 and lower dimensional transposes"); cl_kernel kernel = createKernel(kernelName); setKernelArg(kernel, 0, deviceBuffer_); unsigned numArgs = I->getNumOperands(); for (unsigned arg = 0; arg < numArgs; arg++) { setKernelArg<cl_uint>(kernel, arg + 1, tensors_[I->getOperand(arg).first]); } // Temporary hack to support 3-dim transposes. // TODO: support any dimensional transposes. std::vector<size_t> odim_vec = TR->getDest()->getType()->dims(); std::vector<size_t> idim_vec = TR->getSrc()->getType()->dims(); std::vector<unsigned> mask = TR->getShuffle(); while (mask.size() < 4) { odim_vec.push_back(1); idim_vec.push_back(1); mask.push_back(mask.size()); continue; } auto odim = ShapeNHWC(odim_vec); auto idim = ShapeNHWC(idim_vec); setKernelArg(kernel, 3, odim); setKernelArg(kernel, 4, idim); ShapeNHWC shuff(mask[0], mask[1], mask[2], mask[3]); setKernelArg(kernel, 5, shuff); enqueueKernel(commands_, kernel, deviceId_, {idim.n}, kernelLaunches_); continue; } if (auto *TV = dyn_cast<TensorViewInst>(I)) { assert(tensors_[TV] == tensors_[TV->getSrc()] && "Memory address for a tensor_view should be the same as the " "address of its origin"); (void)TV; continue; } if (auto *C = dyn_cast<CopyInst>(I)) { Value *dest, *src; dest = C->getDest(); src = C->getSrc(); if (src == dest) { continue; } size_t destOff = tensors_[dest]; size_t srcOff = tensors_[src]; size_t sizeInBytes = dest->getSizeInBytes(); cl_int err = clEnqueueCopyBuffer(commands_, deviceBuffer_, deviceBuffer_, srcOff, destOff, sizeInBytes, 0, nullptr, nullptr); GLOW_ASSERT(err == CL_SUCCESS && "Error in clEnqueueCopyBuffer."); continue; } llvm::errs() << "Cannot select: " << I->getKindName() << "\n"; GLOW_UNREACHABLE("compilation failed"); } clFinish(commands_); // Output profiling information. dumpProfileInfo(kernelLaunches_); for (auto &kl : kernelLaunches_) { clReleaseKernel(kl.kernel_); } kernelLaunches_.clear(); auto copiedFromDeviceBytes = copyMutableWeightsFromDevice(); (void)copiedFromDeviceBytes; DEBUG(llvm::dbgs() << "Copied " << copiedFromDeviceBytes << " bytes from OpenCL device\n"); } size_t OCLBackend::copyValueToDevice(const Value *v, void *buf) { size_t copiedBytes = 0; auto it = tensors_.find(v); assert(it != tensors_.end() && "Unknown value"); size_t sizeInBytes = v->getType()->getSizeInBytes(); // Issue a non-blocking command to copy the buffer to the device. if (sizeInBytes) { if (!buf) { Tensor *T = externalTensors_[v]; assert(T && "Expected an external tensor"); buf = T->getUnsafePtr(); } size_t valueOffset = it->second; cl_int err = clEnqueueWriteBuffer( commands_, deviceBuffer_, /* blocking_read */ CL_FALSE, valueOffset, sizeInBytes, buf, /* num_events_in_wait_list */ 0, /* event_list */ nullptr, /* event */ nullptr); GLOW_ASSERT(err == CL_SUCCESS && "Unable to copy data to the device"); copiedBytes += sizeInBytes; } return copiedBytes; } size_t OCLBackend::copyValueFromDevice(const Value *v, void *buf) { size_t copiedBytes = 0; auto it = tensors_.find(v); assert(it != tensors_.end() && "Unknown value"); size_t sizeInBytes = v->getType()->getSizeInBytes(); // Issue a non-blocking command to copy the buffer from the device. if (sizeInBytes) { if (!buf) { Tensor *T = externalTensors_[v]; assert(T && "Expected an external tensor"); buf = T->getUnsafePtr(); } size_t valueOffset = it->second; cl_int err = clEnqueueReadBuffer( commands_, deviceBuffer_, /* blocking_read */ CL_FALSE, valueOffset, sizeInBytes, buf, /* num_events_in_wait_list */ 0, /* event_list */ nullptr, /* event */ nullptr); GLOW_ASSERT(err == CL_SUCCESS && "Unable to copy from the device"); DEBUG(llvm::dbgs() << "Copied the value from device: " << it->first->getName() << "\n"); copiedBytes += sizeInBytes; } return copiedBytes; } size_t OCLBackend::copyMutableWeightsToDevice() { size_t copiedBytes = 0; for (auto it : tensors_) { if (!externalTensors_.count(it.first)) { continue; } if (auto *W = dyn_cast<WeightVar>(it.first)) { if (W->getMutability() == WeightVar::MutabilityKind::Constant) continue; } copiedBytes += copyValueToDevice(it.first); } // Do it! clFinish(commands_); return copiedBytes; } size_t OCLBackend::copyConstantWeightsToDevice() { size_t copiedBytes = 0; for (auto it : tensors_) { if (!externalTensors_.count(it.first)) { continue; } if (auto *W = dyn_cast<WeightVar>(it.first)) { if (W->getMutability() != WeightVar::MutabilityKind::Constant) continue; } copiedBytes += copyValueToDevice(it.first); } // Do it! clFinish(commands_); return copiedBytes; } size_t OCLBackend::copyMutableWeightsFromDevice() { size_t copiedBytes = 0; clFinish(commands_); for (auto it : tensors_) { if (!externalTensors_.count(it.first)) { continue; } if (auto *W = dyn_cast<WeightVar>(it.first)) { if (W->getMutability() == WeightVar::MutabilityKind::Constant) continue; } copiedBytes += copyValueFromDevice(it.first); } clFinish(commands_); return copiedBytes; } void OCLBackend::init() { for (auto &v : F_->getGraph()->getParent()->getVars()) { auto *w = F_->getWeightForNode(v); assert(!externalTensors_.count(w) && "The tensor is already registered"); externalTensors_[w] = &v->getPayload(); } // Assign device-space addresses to the weights. for (auto it : externalTensors_) { Tensor *T = it.second; size_t sizeInBytes = T->getType().getSizeInBytes(); size_t addr = allocator_.allocate(sizeInBytes); // Associate the new buffer with the weight value. tensors_[it.first] = addr; } // Assign device-space addresses to the activations. for (auto &I : F_->getInstrs()) { if (auto *A = llvm::dyn_cast<AllocActivationInst>(I)) { auto numBytes = I->getSizeInBytes(); size_t addr = allocator_.allocate(numBytes); assert(!tensors_.count(A) && "Allocation already made!"); tensors_[A] = addr; continue; } if (auto *TV = llvm::dyn_cast<TensorViewInst>(I)) { assert(!tensors_.count(TV) && "Allocation already made!"); tensors_[TV] = tensors_[TV->getSrc()]; continue; } if (auto *D = llvm::dyn_cast<DeallocActivationInst>(I)) { auto *A = D->getAlloc(); assert(tensors_.count(A) && "Invalid deallocation!"); allocator_.deallocate(tensors_[A]); continue; } } // Ask the memory allocator how much memory is required. What was the high // watermark for this program. size_t requiredSpace = allocator_.getMaxMemoryUsage(); DEBUG(llvm::dbgs() << "Allocated GPU memory block of size: " << requiredSpace << "\n"); // Release the memory from the previous run. if (deviceBuffer_) { freeDeviceBuffer(deviceBuffer_); deviceBuffer_ = nullptr; } deviceBuffer_ = allocDeviceBuffer(requiredSpace); // Copy constant weights just once. copyConstantWeightsToDevice(); } void OCLBackend::clear() { externalTensors_.clear(); } Tensor *OCLBackend::getTensor(const Value *v) const { assert(externalTensors_.count(v) && "Unknown value"); auto ie = externalTensors_.find(v); return ie->second; } cl_mem OCLBackend::allocDeviceBuffer(size_t size) { const size_t alignment = 128; // Always allocate buffers properly aligned to hold values of any type. size = alignedSize(size, alignment); auto buf = clCreateBuffer(context_, CL_MEM_READ_WRITE, size, nullptr, nullptr); GLOW_ASSERT(buf && "Allocation failed!"); return buf; } void OCLBackend::freeDeviceBuffer(cl_mem buf) { clReleaseMemObject(buf); }
package verify import ( "net/http" "github.com/tgbv/telnyx-golang/internal" ) // aliases type Config = internal.Config var e func(int, []byte) error = internal.E /* * handles verification related operations see https://portal.telnyx.com/#/app/verify/profiles */ type Verify struct { Config *Config HttpClient *http.Client } /* * initializes verify */ func InitVerify(c *Config, hc *http.Client) Verify { n := Verify{} n.Config = c n.HttpClient = hc return n }
/** * Class to handle some basics around Google drive and auth. */ // Dependencies const google = require('googleapis').google; require('dotenv').load({ silent: true }); class GoogleDrive { constructor(options = {}) { this.options = options; this.drive = google.drive('v3'); this.scopes = [ 'https://www.googleapis.com/auth/drive', 'https://www.googleapis.com/auth/drive.file' ]; } // Authenticate. Uses path to crednetials file from the // GOOGLE_APPLICATION_CREDENTIALS environmental variable async authenticate() { if (!process.env.GOOGLE_APPLICATION_CREDENTIALS) { throw new Error( 'Requires the GOOGLE_APPLICATION_CREDENTIALS environment variable to be set to the path of a Google API credentials file.' ); } return await google.auth.getClient({ scopes: this.scopes }); } // Share with someone. // role is probably going to be 'owner' or 'writer' // Transfer is used with owner to changer ownership of file async share(id, email, role = 'writer', transfer = false) { if (!id) { throw new Error('File id not provided to addOwner method'); } if (!email) { throw new Error('Email not provided to addOwner method'); } let auth = await this.authenticate(); return await this.drive.permissions.create({ auth: auth, resource: { role: role, type: 'user', emailAddress: email }, fileId: id, transferOwnership: transfer }); } // Wrapper to make owner async owner(id, email) { return await this.share(id, email, 'owner', true); } } // Export module.exports = GoogleDrive;
<filename>libs/hal-form-client/src/lib/domain/link.ts import { HttpClient } from '@angular/common/http'; import { Observable, throwError } from 'rxjs'; import { first, map } from 'rxjs/operators'; import * as parser from 'url-template'; import { InjectorInstance } from '../hal-form-client.module'; import { ContentTypeEnum } from './content-type.enum'; import { Resource } from './resource'; export interface ILink { href: string; templated?: boolean; type?: string; name?: string; } export class Link implements ILink { private httpClient: HttpClient = InjectorInstance.get(HttpClient); href: string; templated?: boolean; type?: string; name?: string; constructor(raw: ILink) { this.href = raw.href; this.templated = raw.templated; this.type = raw.type; this.name = raw.name; } parseUrl(params: any): string | null { if (this.templated && !params) { return null; } const template = parser.parse(this.href); return template.expand(params); } get<T extends Resource = Resource>(params?: any): Observable<T> { const url = this.parseUrl(params); return url ? this.httpClient.get<T>(url, { headers: { Accept: ContentTypeEnum.APPLICATION_JSON_HAL_FORMS } }).pipe( first(), map((res: T) => new Resource(res || {}) as T), ) : throwError(() => new Error(`Un-parsable Url ${url}, ${this.href}, ${params}`)); } }
<reponame>mheidingsfeld/parametric-cubic-spline /* * MIT License * * Parametric Cubic Spline Library * Copyright (c) 2021-, <NAME> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ #include <initializer_list> #include <vector> #include <cmath> #include "gtest/gtest.h" #include "parametric_cubic_spline/parametric_cubic_spline.h" using namespace parametric_cubic_spline; class TestProblem { public: std::vector<float> points_; std::size_t num_points_; std::size_t num_dims_; BoundaryCondition left_bc_; BoundaryCondition right_bc_; std::vector<float> left_tangent_; std::vector<float> right_tangent_; std::vector<float> eval_pos_; std::vector<float> expected_points_; TestProblem() = default; TestProblem( std::initializer_list<float> points, std::size_t num_points, std::size_t num_dims, BoundaryCondition left_bc, BoundaryCondition right_bc, std::initializer_list<float> left_tangent, std::initializer_list<float> right_tangent, std::initializer_list<float> eval_pos, std::initializer_list<float> expected_points ) : points_(points), num_points_(num_points), num_dims_(num_dims), left_bc_(left_bc), right_bc_(right_bc), left_tangent_(left_tangent), right_tangent_(right_tangent), eval_pos_(eval_pos), expected_points_(expected_points) {}; }; static const TestProblem test_problem1( { 1.0, 0.0, -1.0, 0.0, 0.0, 1.0, 0.0,-1.0 }, 4, 2, BoundaryCondition::Natural, BoundaryCondition::Natural, { 0.0, 0.0 }, { 0.0, 0.0 }, { 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0 }, { 1.0000, 0.0000, 0.1634,-0.1274,-0.5328,-0.1792, \ -0.9482,-0.0798,-0.9600, 0.2320,-0.6500, 0.6500, \ -0.2320, 0.9600, 0.0798, 0.9482, 0.1792, 0.5328, \ 0.1274,-0.1634, 0.0000,-1.0000 } ); static const TestProblem test_problem2( { 1.0, 0.0, -1.0, 0.0, 0.0, 1.0, 0.0,-1.0 }, 4, 2, BoundaryCondition::Hermite, BoundaryCondition::Hermite, { 0.0,-1.0 }, {-1.0, 0.0 }, { 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0 }, { 1.0000, 0.0000, 0.6352,-0.2268,-0.1424,-0.2784, \ -0.8576,-0.1116,-1.0731, 0.3003,-0.7917, 0.7917, \ -0.3003, 1.0731, 0.1116, 0.8576, 0.2784, 0.1424, \ 0.2268,-0.6352, 0.0000,-1.0000 } ); static const TestProblem test_problem3( { 1.0, 0.0, -1.0, 0.0, 0.0, 1.0, 0.0,-1.0 }, 4, 2, BoundaryCondition::Periodic, BoundaryCondition::Periodic, { 0.0, 0.0 }, { 0.0, 0.0 }, { 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0 }, { 1.0000, 0.0000, 0.5050, 0.0630,-0.2600,-0.0360, \ -0.8900,-0.0540,-1.0160, 0.2240,-0.6875, 0.6875, \ -0.2240, 1.0160, 0.0540, 0.8900, 0.0360, 0.2600, \ -0.0630,-0.5050, 0.0000,-1.0000 } ); class TestFixture: public ::testing::TestWithParam<TestProblem> { }; INSTANTIATE_TEST_SUITE_P( TestSuite, TestFixture, ::testing::Values( test_problem1, test_problem2, test_problem3 ) ); TEST_P(TestFixture, DynamicPointsDynamicDims) { TestProblem problem = GetParam(); Spline<float, Dynamic, Dynamic> spline; spline.set( problem.points_.data(), problem.num_points_, problem.num_dims_, problem.left_bc_, problem.right_bc_, problem.left_tangent_.data(), problem.right_tangent_.data() ); std::size_t eval_points_size = problem.eval_pos_.size()*problem.num_dims_; std::vector<float> eval_points(eval_points_size, 0.0); spline.eval(problem.eval_pos_.data(), 11, eval_points.data()); for(std::size_t i = 0; i < eval_points_size; i++) { EXPECT_LT(fabs(eval_points[i] - problem.expected_points_[i]), 0.001); } } TEST_P(TestFixture, DynamicPointsFixedDims) { TestProblem problem = GetParam(); Spline<float, Dynamic, 2> spline; spline.set( problem.points_.data(), problem.num_points_, problem.left_bc_, problem.right_bc_, problem.left_tangent_.data(), problem.right_tangent_.data() ); std::size_t eval_points_size = problem.eval_pos_.size()*problem.num_dims_; std::vector<float> eval_points(eval_points_size, 0.0); spline.eval(problem.eval_pos_.data(), 11, eval_points.data()); for(std::size_t i = 0; i < eval_points_size; i++) { EXPECT_LT(fabs(eval_points[i] - problem.expected_points_[i]), 0.001); } } TEST_P(TestFixture, FixedPointsFixedDims) { TestProblem problem = GetParam(); Spline<float, 4, 2> spline; spline.set( problem.points_.data(), problem.left_bc_, problem.right_bc_, problem.left_tangent_.data(), problem.right_tangent_.data() ); std::size_t eval_points_size = problem.eval_pos_.size()*problem.num_dims_; std::vector<float> eval_points(eval_points_size, 0.0); spline.eval(problem.eval_pos_.data(), 11, eval_points.data()); for(std::size_t i = 0; i < eval_points_size; i++) { EXPECT_LT(fabs(eval_points[i] - problem.expected_points_[i]), 0.001); } }
import re def is_valid_email(email): if re.search(r'^[\w\.\+\-]+\@[\w]+\.[a-z]{2,3}$', email): return 'Valid email address' else: return 'Invalid email address' result = is_valid_email(email) print(result)
<reponame>zhaosiwen1949/malagu<filename>packages/core/src/node/view/text-view.ts<gh_stars>0 import { Component } from '../../common'; import { View } from './view-protocol'; import { Context } from '../context'; @Component(View) export class TextView implements View { static VIEW_NAME = 'text'; readonly contentType = 'text/plain'; readonly priority = 600; async render(model: any): Promise<void> { const response = Context.getCurrent().response; response.body = model; } support(viewName: string): Promise<boolean> { return Promise.resolve(viewName === TextView.VIEW_NAME); } }
package net.community.chest.io.encode.qp; import java.io.IOException; import java.io.OutputStream; import net.community.chest.io.encode.DecodingException; import net.community.chest.io.encode.OutputStreamDecoder; import net.community.chest.io.output.OutputStreamEmbedder; /** * Helper class that accept QP encoded data and writes it decoded to the underlying stream * @author lyorg * 04/03/2004 */ public class QPDecodeOutputStream extends OutputStreamEmbedder implements OutputStreamDecoder { private int _options; private final boolean _throwExceptions; private DecodingException _decExc /* =null */; /* * @see net.community.chest.io.encode.OutputStreamDecoder#getDecodeException() */ @Override public DecodingException getDecodeException () { return _decExc; } /** * Updates the last set decoding exception - provided one not already set * @param exc exception to be set * @throws DecodingException same as input if {@link #_throwExceptions} is TRUE */ protected void setDecodeException (final DecodingException exc) throws DecodingException { if ((null == _decExc) && (exc != null) /* should not be otherwise */) { _decExc = exc; // no need to throw further exceptions after first one _options &= (~QuotedPrintable.DECOPT_THROW_EXCEPTION); } if (_throwExceptions) throw exc; } private byte[] _qpVal=new byte[QuotedPrintable.QPENCLEN]; private int _qpLen /* =0 */; public QPDecodeOutputStream (OutputStream ost, int options, boolean realClose) { super(ost, realClose); _throwExceptions = (QuotedPrintable.DECOPT_THROW_EXCEPTION == (options & QuotedPrintable.DECOPT_THROW_EXCEPTION)); // start with this option _options = options | QuotedPrintable.DECOPT_THROW_EXCEPTION; } public QPDecodeOutputStream (OutputStream ost, boolean realClose) { this(ost, QuotedPrintable.DECOPT_THROW_EXCEPTION, realClose); } /* * @see java.io.OutputStream#close() */ @Override public void close () throws IOException { if (this.out != null) { try { super.close(); if (_qpLen > 0) setDecodeException(new QuotedPrintableDecodingException("Incomplete QP value leftover (" + _qpLen + " chars", (char) _qpVal[0])); } finally { this.out = null; } } } /** * @param hiChar QP hi character value * @param loChar QP hi character value * @throws DecodingException if bad/illegal decoding * @throws IOException if unable to write decoded result to real output stream */ protected void decode (byte hiChar, byte loChar) throws IOException, DecodingException { try { // force exception so we can catch and cache it QuotedPrintable.decode((short) (hiChar & 0x00FF), (short) (loChar & 0x00FF), this.out, _options); } catch(QuotedPrintableDecodingException de) { setDecodeException(de); } } /* * @see java.io.OutputStream#write(byte[], int, int) */ @Override public void write (byte[] buf, int offset, int len) throws IOException { if (null == this.out) throw new IOException("No underlying stream to write to"); if ((len < 0) || (offset < 0)) throw new IOException("Negative buffer range"); if (0 == len) return; final int maxOffset=(offset+len); if ((null == buf) || (maxOffset > buf.length)) throw new IOException("Bad buffer range"); int lastOffset=offset; // last offset to un-encoded data for (int curOffset=offset, remLen=len; (curOffset < maxOffset) && (remLen > 0); curOffset++, remLen--) { final byte bVal=buf[curOffset]; // check if in mid-accumulation of a QP value if (_qpLen > 0) { _qpVal[_qpLen] = bVal; _qpLen++; // check if accumulated enough data for a decoding if (_qpLen >= QuotedPrintable.QPENCLEN) { decode(_qpVal[1], _qpVal[2]); _qpLen = 0; } lastOffset = (curOffset + 1); } else if (QuotedPrintable.QPDELIM == bVal) { // "flush" any "clear" data if (curOffset > lastOffset) this.out.write(buf, lastOffset, (curOffset - lastOffset)); // check if have enough data to decode on the spot without accumulating if (remLen >= QuotedPrintable.QPENCLEN) { decode(buf[curOffset+1], buf[curOffset+2]); curOffset += 2; remLen -= 2; } else // accumulate { _qpVal[0] = bVal; _qpLen = 1; } lastOffset = (curOffset + 1); } } // check if any leftovers if (lastOffset < maxOffset) this.out.write(buf, lastOffset, maxOffset - lastOffset); } /* * @see net.community.chest.io.OutputStreamEmbedder#write(int) */ @Override public void write (int val) throws IOException { write(new byte[] { (byte) val }, 0, 1); } }
<gh_stars>1-10 package cn.gobyte.apply.security.pojo; import lombok.Data; import lombok.EqualsAndHashCode; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.userdetails.User; import java.util.Collection; import java.util.Date; @EqualsAndHashCode(callSuper = true) @Data public class myUserDetails extends User { public myUserDetails(String username, String password, boolean enabled, boolean accountNonExpired, boolean credentialsNonExpired, boolean accountNonLocked, Collection<? extends GrantedAuthority> authorities) { super(username, password, enabled, accountNonExpired, credentialsNonExpired, accountNonLocked, authorities); } public myUserDetails(String username, String password, Collection<? extends GrantedAuthority> authorities, Integer accountStatus) { super(username, password, authorities); } /** * 系统默认id */ private Long systemid; /** * 登陆超时 */ private String loginTime; /** * 身份证号 */ private String id; /** * 密码 */ private String password; /** * 提示问题 */ private String tswt; /** * 问题答案 */ private String mmda; /** * 邮箱 */ private String email; /** * 用户角色 */ private String sid; /** * 姓名 */ private String name; /** * 生日 */ private String birthd; /** * 性别 */ private String gender; /** * 民族 */ private String mz; /** * 政治面貌 */ private String zzmm; /** * 电话号 */ private String tel; /** * 地址 */ private String address; /** * 学校 */ private String school; /** * 学校代码 */ private String schoolc; /** * 主修科目 */ private String major; /** * 高考报名号 */ private String gkbmh; /** * 报考科目 */ private String bkmajor; /** * 报考专业的代码 */ private String mcode; /** * 记录 */ private String jl; /** * 退出 */ private String tc; /** * 联系地址 */ private String lxaddress; /** * 邮编 */ private String yb; /** * 状态 */ private String state; /** * 时间 */ private String sj; /** * 准考证号 */ private String zkzh; /** * 省份 */ private String sf; /** * 创建时间 */ private Date creatTime; /** * 修改时间 */ private Date modifyTime; /** * 最近访问时间 */ private Date lastLoginTime; /** * 主题 */ private String theme; /** * 头像 */ private String avatar; /** * 描述 */ private String description; /** * 账号状态:0锁定 1有效 */ private Integer accountStatus; /** * 客户登陆的ip */ private String ip; public myUserDetails(String username, String password, Collection<? extends GrantedAuthority> authorities, Long systemid, String loginTime, String id, String password1, String tswt, String mmda, String email, String sid, String name, String birthd, String gender, String mz, String zzmm, String tel, String address, String school, String schoolc, String major, String gkbmh, String bkmajor, String mcode, String jl, String tc, String lxaddress, String yb, String state, String sj, String zkzh, String sf, Date creatTime, Date modifyTime, Date lastLoginTime, String theme, String avatar, String description, Integer accountStatus) { super(username, password, authorities); this.systemid = systemid; this.loginTime = loginTime; this.id = id; this.password = <PASSWORD>; this.tswt = tswt; this.mmda = mmda; this.email = email; this.sid = sid; this.name = name; this.birthd = birthd; this.gender = gender; this.mz = mz; this.zzmm = zzmm; this.tel = tel; this.address = address; this.school = school; this.schoolc = schoolc; this.major = major; this.gkbmh = gkbmh; this.bkmajor = bkmajor; this.mcode = mcode; this.jl = jl; this.tc = tc; this.lxaddress = lxaddress; this.yb = yb; this.state = state; this.sj = sj; this.zkzh = zkzh; this.sf = sf; this.creatTime = creatTime; this.modifyTime = modifyTime; this.lastLoginTime = lastLoginTime; this.theme = theme; this.avatar = avatar; this.description = description; this.accountStatus = accountStatus; } }
import { Map } from 'immutable' import { convertFromHTML } from 'draft-convert' import { MENTION_ENTITY_TYPE, TOPIC_ENTITY_TYPE } from 'hylo-utils/constants' // NOTE: Legacy mention links are in this format -- // <a href="/u/99" data-user-id="99">Hylo User</a> // export function createMentionFromLink (contentState, node) { const mention = Map({ id: node.getAttribute('data-user-id'), name: node.text, avatar: '' }) const contentStateWithEntity = contentState.createEntity( MENTION_ENTITY_TYPE, 'SEGMENTED', // reference from plugin config? { mention } ) return contentStateWithEntity.getLastCreatedEntityKey() } // NOTE: Legacy Topics are in this format -- // <a>#topic</a> // export function createTopicFromLink (contentState, node) { const topic = Map({ name: node.text.substring(1) }) const contentStateWithEntity = contentState.createEntity( TOPIC_ENTITY_TYPE, 'IMMUTABLE', // reference from plugin config? { mention: topic } ) return contentStateWithEntity.getLastCreatedEntityKey() } export default function (contentState, html) { return convertFromHTML({ htmlToEntity: (nodeName, node) => { if (nodeName === 'a' && (node.getAttribute('data-entity-type') === MENTION_ENTITY_TYPE || node.getAttribute('data-user-id'))) { return createMentionFromLink(contentState, node) } else if (nodeName === 'a' && (node.getAttribute('data-entity-type') === TOPIC_ENTITY_TYPE || node.text[0] === '#')) { return createTopicFromLink(contentState, node) } } })(html) }
import { h, hydrate } from "../../deps.ts"; import App from "../../components/core/App.tsx"; hydrate( <App url={window.location.pathname} />, document.querySelector("body")!, );
from __future__ import absolute_import import pkg_resources import numpy as np from .PQmath import ( ObjectiveFunctionQuats, QuatSeq, orientation_to_quat, quat_to_orient, CachingObjectiveFunctionQuats, QuatSmoother, ) import nose class TestPQmath: def setUp(self): D2R = np.pi / 180.0 fps = 200.0 t = np.arange(0, 0.1 * fps) / fps yaw_angle = np.sin((2 * np.pi * t) / 4) pitch_angle = 45 * D2R * np.ones_like(yaw_angle) z_pitch = np.sin(pitch_angle) r_pitch = np.cos(pitch_angle) direction_vec = np.array( [r_pitch * np.cos(yaw_angle), r_pitch * np.sin(yaw_angle), z_pitch] ).T if 1: noise_mag = 0.3 np.random.seed(4) unscaled_noise = np.random.randn(len(t), 3) direction_vec += noise_mag * unscaled_noise # (re-)normalize r = np.sqrt(np.sum(direction_vec ** 2, axis=1)) direction_vec = direction_vec / r[:, np.newaxis] self.Q = QuatSeq([orientation_to_quat(U) for U in direction_vec]) self.fps = fps def test_Qsmooth_slow(self): Qsmooth = QuatSmoother(frames_per_second=self.fps).smooth_quats( self.Q, objective_func_name="ObjectiveFunctionQuats" ) def test_Qsmooth_caching(self): Qsmooth = QuatSmoother(frames_per_second=self.fps).smooth_quats( self.Q, objective_func_name="CachingObjectiveFunctionQuats" ) def test_Qsmooth_side_effects(self): for of in ["CachingObjectiveFunctionQuats", "ObjectiveFunctionQuats"]: yield self.check_Qsmooth_side_effects, of def check_Qsmooth_side_effects(self, objective_func_name): no_distance_penalty_idxs = [3, 8] Qtest = self.Q.copy() for i in no_distance_penalty_idxs: Qtest[i] = orientation_to_quat((1, 0, 0)) Qtest_orig = Qtest.copy() Qsmooth_v1 = QuatSmoother(frames_per_second=self.fps).smooth_quats( Qtest, objective_func_name=objective_func_name, no_distance_penalty_idxs=no_distance_penalty_idxs, ) # check for side-effects for i, (qtest, qexpected) in enumerate(zip(Qtest, Qtest_orig)): assert qtest == qexpected def test_Qsmooth_missing(self): for of in ["CachingObjectiveFunctionQuats", "ObjectiveFunctionQuats"]: yield self.check_Qsmooth_missing, of def check_Qsmooth_missing(self, objective_func_name): no_distance_penalty_idxs = [3, 8] objective_func_name = "CachingObjectiveFunctionQuats" # objective_func_name='ObjectiveFunctionQuats' # If these are really missing and not considered from the # distance function, the two results should converge. Qtest = self.Q.copy() for i in no_distance_penalty_idxs: Qtest[i] = orientation_to_quat((1, 0, 0)) Qsmooth_v1 = QuatSmoother(frames_per_second=self.fps).smooth_quats( Qtest, objective_func_name=objective_func_name, no_distance_penalty_idxs=no_distance_penalty_idxs, ) Qtest = self.Q[:] for i in no_distance_penalty_idxs: Qtest[i] = orientation_to_quat((0, 0, 1)) Qsmooth_v2 = QuatSmoother(frames_per_second=self.fps).smooth_quats( Qtest, objective_func_name=objective_func_name, no_distance_penalty_idxs=no_distance_penalty_idxs, ) D2R = np.pi / 180.0 for i, (q1, q2) in enumerate(zip(Qsmooth_v1, Qsmooth_v2)): # Due to early termination criteria, these probably won't # be exactly alike, so just compare that angle between two # is reasonably small. Could tighten termination criteria # and then reduce this threshold angle for errors. vec_v1 = quat_to_orient(q1) vec_v2 = quat_to_orient(q2) dot = np.dot(vec_v1, vec_v2) dot = min(1.0, dot) # clip to prevent arccos returning nan angle = np.arccos(dot) assert angle < (60 * D2R) def test_Qsmooth_both(self): Qsmooth_slow = QuatSmoother(frames_per_second=self.fps).smooth_quats( self.Q, objective_func_name="ObjectiveFunctionQuats", ) Qsmooth_cache = QuatSmoother(frames_per_second=self.fps).smooth_quats( self.Q, objective_func_name="CachingObjectiveFunctionQuats", ) for i, (qs, qc) in enumerate(zip(Qsmooth_slow, Qsmooth_cache)): assert qs == qc if __name__ == "__main__": nose.main()
/** * This software is subject to the ANT+ Shared Source License * www.thisisant.com/swlicenses * Copyright (c) Garmin Canada Inc. 2014 * All rights reserved. * * Redistribution and use in source and binary forms, with or * without modification, are permitted provided that the following * conditions are met: * * 1) Redistributions of source code must retain the above * copyright notice, this list of conditions and the following * disclaimer. * * 2) Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * 3) Neither the name of Garmin nor the names of its * contributors may be used to endorse or promote products * derived from this software without specific prior * written permission. * * The following actions are prohibited: * * 1) Redistribution of source code containing the ANT+ Network * Key. The ANT+ Network Key is available to ANT+ Adopters. * Please refer to http://thisisant.com to become an ANT+ * Adopter and access the key. * * 2) Reverse engineering, decompilation, and/or disassembly of * software provided in binary form under this license. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE HEREBY * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES(INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; DAMAGE TO ANY DEVICE, LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. SOME STATES DO NOT ALLOW * THE EXCLUSION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THE * ABOVE LIMITATIONS MAY NOT APPLY TO YOU. * */ /**@file * @defgroup * @{ * @ingroup * * @brief */ #include "asc_pages.h" #include <stdint.h> #include <stdbool.h> #include <string.h> #include "asc_parameters.h" #include "ant_parameters.h" #include "nrf_error.h" #ifdef TWO_BYTE_SHARED_ADDRESS void asc_encode_set_shared_address(uint16_t shared_address, uint8_t * p_tx_buffer) { memset(p_tx_buffer, RESERVED_ZEROS, ANT_STANDARD_DATA_PAYLOAD_SIZE); p_tx_buffer[ENCODE_SHARED_ADDRESS_BYTE1] = (uint8_t) shared_address; p_tx_buffer[ENCODE_SHARED_ADDRESS_BYTE2] = (uint8_t) (shared_address >> 8); p_tx_buffer[ENCODE_PAGE_ID_BYTE] = SET_SLAVE_ADDRESS_PID; } #else void asc_encode_set_shared_address(uint8_t shared_address, uint8_t * p_tx_buffer) { memset(p_tx_buffer, RESERVED_ZEROS, ANT_STANDARD_DATA_PAYLOAD_SIZE); p_tx_buffer[ENCODE_SHARED_ADDRESS_BYTE] = shared_address; p_tx_buffer[ENCODE_PAGE_ID_BYTE] = SET_SLAVE_ADDRESS_PID; } #endif void asc_encode_address_available_page(asc_addr_available_paramters_t params, uint8_t * p_tx_buffer) { memset(p_tx_buffer, RESERVED_ONES, ANT_STANDARD_DATA_PAYLOAD_SIZE); p_tx_buffer[ENCODE_PAGE_ID_BYTE] = ADDRESS_AVAILABLE_PID; #ifdef TWO_BYTE_SHARED_ADDRESS p_tx_buffer[ENCODE_SHARED_ADDRESS_BYTE1] = (uint8_t) SEARCH_ADDRESS; p_tx_buffer[ENCODE_SHARED_ADDRESS_BYTE2] = (uint8_t) (SEARCH_ADDRESS >> 8); #else p_tx_buffer[ENCODE_SHARED_ADDRESS_BYTE] = SEARCH_ADDRESS; #endif p_tx_buffer[3] = 0x0F | (params.channel_period << 4); p_tx_buffer[5] = params.backoff_range; p_tx_buffer[6] = (uint8_t) params.data_timeout >> 1; //divide data timeout seconds by two for transmission p_tx_buffer[7] = ADDRESS_AVAILABLE_MASK & params.is_address_available; } void asc_encode_request_address_page(uint32_t serial_num, uint8_t * p_tx_buffer) { memset(p_tx_buffer, RESERVED_ONES, ANT_STANDARD_DATA_PAYLOAD_SIZE); p_tx_buffer[ENCODE_PAGE_ID_BYTE] = REQUEST_ADDRESS_PID; #ifdef TWO_BYTE_SHARED_ADDRESS p_tx_buffer[ENCODE_SHARED_ADDRESS_BYTE1] = (uint8_t) SEARCH_ADDRESS; p_tx_buffer[ENCODE_SHARED_ADDRESS_BYTE2] = (uint8_t) (SEARCH_ADDRESS >> 8); p_tx_buffer[5] = (uint8_t) serial_num; p_tx_buffer[6] = (uint8_t) (serial_num >> 8); p_tx_buffer[7] = (uint8_t) (serial_num >> 16); #else p_tx_buffer[ENCODE_SHARED_ADDRESS_BYTE] = SEARCH_ADDRESS; p_tx_buffer[4] = (uint8_t) serial_num; p_tx_buffer[5] = (uint8_t) (serial_num >> 8); p_tx_buffer[6] = (uint8_t) (serial_num >> 16); p_tx_buffer[7] = (uint8_t) (serial_num >> 24); #endif } #ifdef TWO_BYTE_SHARED_ADDRESS void asc_encode_busy_acquiring_page(uint16_t next_address, uint32_t serial_num, uint8_t * p_tx_buffer) { memset(p_tx_buffer, RESERVED_ONES, ANT_STANDARD_DATA_PAYLOAD_SIZE); p_tx_buffer[ENCODE_SHARED_ADDRESS_BYTE1] = (uint8_t) REGISTER_ADDRESS; p_tx_buffer[ENCODE_SHARED_ADDRESS_BYTE2] = (uint8_t) (REGISTER_ADDRESS >> 8); p_tx_buffer[ENCODE_PAGE_ID_BYTE] = BUSY_ACQUIRING_PID; p_tx_buffer[3] = (uint8_t) next_address; p_tx_buffer[4] = (uint8_t) (next_address >> 8); p_tx_buffer[5] = (uint8_t) serial_num; //Serial number LSB p_tx_buffer[6] = (uint8_t) (serial_num >> 8); //Serial number p_tx_buffer[7] = (uint8_t) (serial_num >> 16); //Serial number MSB } #else void asc_encode_busy_acquiring_page(uint8_t next_address, uint32_t serial_num, uint8_t * p_tx_buffer) { memset(p_tx_buffer, RESERVED_ONES, ANT_STANDARD_DATA_PAYLOAD_SIZE); p_tx_buffer[ENCODE_SHARED_ADDRESS_BYTE] = REGISTER_ADDRESS; p_tx_buffer[ENCODE_PAGE_ID_BYTE] = BUSY_ACQUIRING_PID; p_tx_buffer[3] = next_address; p_tx_buffer[4] = (uint8_t) serial_num; //Serial number LSB p_tx_buffer[5] = (uint8_t) (serial_num >> 8); //Serial number p_tx_buffer[6] = (uint8_t) (serial_num >> 16); //Serial number p_tx_buffer[7] = (uint8_t) (serial_num >> 24); //Serial number MSB } #endif void asc_encode_confirm_acquire_page(asc_confirm_acquire_paramters_t params, uint8_t * p_tx_buffer) { memset(p_tx_buffer, RESERVED_ONES, ANT_STANDARD_DATA_PAYLOAD_SIZE); p_tx_buffer[ENCODE_PAGE_ID_BYTE] = CONFIRM_ACQUIRE_PID; #ifdef TWO_BYTE_SHARED_ADDRESS p_tx_buffer[ENCODE_SHARED_ADDRESS_BYTE1] = (uint8_t) REGISTER_ADDRESS; p_tx_buffer[ENCODE_SHARED_ADDRESS_BYTE2] = (uint8_t) (REGISTER_ADDRESS >> 8); #else p_tx_buffer[ENCODE_SHARED_ADDRESS_BYTE] = REGISTER_ADDRESS; #endif p_tx_buffer[3] = (uint8_t) params.serial_number; p_tx_buffer[4] = (uint8_t) params.model_number; p_tx_buffer[5] = (uint8_t) (params.model_number >> 8); p_tx_buffer[6] = params.hw_revision; p_tx_buffer[7] = params.sw_revision; } void asc_encode_command_page(asc_command_data_t command_data, uint8_t * p_tx_buffer) { memset(p_tx_buffer, RESERVED_ONES, ANT_STANDARD_DATA_PAYLOAD_SIZE); p_tx_buffer[ENCODE_PAGE_ID_BYTE] = COMMAND_PID; #ifdef TWO_BYTE_SHARED_ADDRESS p_tx_buffer[ENCODE_SHARED_ADDRESS_BYTE1] = (uint8_t) command_data.shared_address; p_tx_buffer[ENCODE_SHARED_ADDRESS_BYTE2] = (uint8_t) (command_data.shared_address >> 8); #else p_tx_buffer[ENCODE_SHARED_ADDRESS_BYTE] = command_data.shared_address; #endif p_tx_buffer[3] = (uint8_t) (command_data.group_number << 4); p_tx_buffer[7] = (uint8_t) command_data.command; } void asc_encode_phone_command_page(asc_command_data_t command_data, uint8_t * p_tx_buffer) { memset(p_tx_buffer, RESERVED_ONES, ANT_STANDARD_DATA_PAYLOAD_SIZE); p_tx_buffer[0] = PHONE_COMMAND_PID; #ifdef TWO_BYTE_SHARED_ADDRESS p_tx_buffer[1] = (uint8_t) command_data.shared_address; p_tx_buffer[2] = (uint8_t) (command_data.shared_address >> 8); #else p_tx_buffer[1] = command_data.shared_address; #endif p_tx_buffer[3] = (uint8_t) command_data.master_id; p_tx_buffer[4] = (uint8_t) (command_data.master_id >> 8); p_tx_buffer[5] = (uint8_t) (command_data.group_number << 4); p_tx_buffer[7] = (uint8_t) command_data.command; } void asc_encode_update_data_page(asc_update_data_t update_data, uint8_t * p_tx_buffer) { memset(p_tx_buffer, RESERVED_ONES, ANT_STANDARD_DATA_PAYLOAD_SIZE); p_tx_buffer[ENCODE_PAGE_ID_BYTE] = UPDATE_DATA_PID; #ifdef TWO_BYTE_SHARED_ADDRESS p_tx_buffer[ENCODE_SHARED_ADDRESS_BYTE1] = (uint8_t) update_data.shared_address; p_tx_buffer[ENCODE_SHARED_ADDRESS_BYTE2] = (uint8_t) (update_data.shared_address >> 8); #else p_tx_buffer[ENCODE_SHARED_ADDRESS_BYTE] = update_data.shared_address; #endif p_tx_buffer[7] = (uint8_t) update_data.state; } void asc_encode_phone_update_data_page(asc_update_data_t update_data, uint8_t * p_tx_buffer) { memset(p_tx_buffer, RESERVED_ONES, ANT_STANDARD_DATA_PAYLOAD_SIZE); p_tx_buffer[ENCODE_PHONE_PAGE_ID_BYTE] = UPDATE_DATA_PID; #ifdef TWO_BYTE_SHARED_ADDRESS p_tx_buffer[ENCODE_PHONE_SHARED_ADDRESS_BYTE1] = (uint8_t) update_data.shared_address; p_tx_buffer[ENCODE_PHONE_SHARED_ADDRESS_BYTE2] = (uint8_t) (update_data.shared_address >> 8); #else p_tx_buffer[ENCODE_PHONE_SHARED_ADDRESS_BYTE1] = update_data.shared_address; #endif p_tx_buffer[3] = (uint8_t) update_data.master_id; p_tx_buffer[4] = (uint8_t) (update_data.master_id >> 8); p_tx_buffer[7] = (uint8_t) update_data.state; } void asc_encode_request_data_page(asc_request_data_t request_data, uint8_t * p_tx_buffer) { memset(p_tx_buffer, RESERVED_ONES, ANT_STANDARD_DATA_PAYLOAD_SIZE); p_tx_buffer[ENCODE_PAGE_ID_BYTE] = REQUEST_DATA_PID; #ifdef TWO_BYTE_SHARED_ADDRESS p_tx_buffer[ENCODE_SHARED_ADDRESS_BYTE1] = (uint8_t) request_data.shared_address; p_tx_buffer[ENCODE_SHARED_ADDRESS_BYTE2] = (uint8_t) (request_data.shared_address >> 8); #else p_tx_buffer[ENCODE_SHARED_ADDRESS_BYTE] = request_data.shared_address; #endif p_tx_buffer[6] = request_data.page_id_requested; p_tx_buffer[7] = (uint8_t) 0x01; } void asc_encode_device_availability_page(uint16_t neighbor_id, uint8_t * p_tx_buffer) { memset(p_tx_buffer, RESERVED_ONES, ANT_STANDARD_DATA_PAYLOAD_SIZE); p_tx_buffer[0] = DEVICE_AVAILABILITY_PID; p_tx_buffer[1] = (uint8_t) neighbor_id; p_tx_buffer[2] = (uint8_t) (neighbor_id >> 8); } uint32_t asc_decode_address_available_page(asc_addr_available_paramters_t * p_params, uint8_t * p_rx_buffer) { if (p_rx_buffer[DECODE_PAGE_ID_BYTE] == ADDRESS_AVAILABLE_PID) { p_params->channel_period = (asc_message_periods_t) ( p_rx_buffer[ANT_MESSAGE_DATA3_OFFSET] >> 4); p_params->is_address_available = p_rx_buffer[ANT_MESSAGE_DATA7_OFFSET] & ADDRESS_AVAILABLE_MASK; p_params->backoff_range = p_rx_buffer[ANT_MESSAGE_DATA5_OFFSET]; p_params->data_timeout = p_rx_buffer[ANT_MESSAGE_DATA6_OFFSET] << 1; //Multiply data timeout by 2 to get total timeout in seconds return NRF_SUCCESS; } else { return NRF_ERROR_INVALID_PARAM; } } uint32_t asc_decode_request_address_page(uint32_t * serial_number, uint8_t * p_rx_buffer) { if (p_rx_buffer[DECODE_PAGE_ID_BYTE] == REQUEST_ADDRESS_PID) { #ifdef TWO_BYTE_SHARED_ADDRESS *serial_number = (uint32_t) p_rx_buffer[ANT_MESSAGE_DATA5_OFFSET] | ((uint32_t) p_rx_buffer[ANT_MESSAGE_DATA6_OFFSET] << 8) | ((uint32_t) p_rx_buffer[ANT_MESSAGE_DATA7_OFFSET] << 16) ; #else *serial_number = (uint32_t) p_rx_buffer[ANT_MESSAGE_DATA4_OFFSET] | ((uint32_t) p_rx_buffer[ANT_MESSAGE_DATA5_OFFSET] << 8) | ((uint32_t) p_rx_buffer[ANT_MESSAGE_DATA6_OFFSET] << 16) | ((uint32_t) p_rx_buffer[ANT_MESSAGE_DATA7_OFFSET] << 24); #endif return NRF_SUCCESS; } else { return NRF_ERROR_INVALID_PARAM; } } #ifdef TWO_BYTE_SHARED_ADDRESS uint32_t asc_decode_busy_acquiring_page(uint32_t serial_number, bool * p_is_serial_match, uint16_t * next_address, uint8_t * p_rx_buffer) { if (p_rx_buffer[DECODE_PAGE_ID_BYTE] == BUSY_ACQUIRING_PID) { //Check to see that the received serial number in the message buffer matches the serial number argument. uint32_t received_serial_number = ((uint32_t) p_rx_buffer[ANT_MESSAGE_DATA7_OFFSET] << 16 | (uint32_t) p_rx_buffer[ANT_MESSAGE_DATA6_OFFSET] << 8 | (uint32_t) p_rx_buffer[ANT_MESSAGE_DATA5_OFFSET]); if ((serial_number & 0xFFF) == (received_serial_number & 0xFFF)) { *p_is_serial_match = true; *next_address = (p_rx_buffer[ANT_MESSAGE_DATA4_OFFSET] << 8 | p_rx_buffer[ANT_MESSAGE_DATA3_OFFSET]); } else { *p_is_serial_match = false; } return NRF_SUCCESS; } else { return NRF_ERROR_INVALID_PARAM; } } #else uint32_t asc_decode_busy_acquiring_page(uint32_t serial_number, bool * p_is_serial_match, uint8_t * next_address, uint8_t * p_rx_buffer) { if (p_rx_buffer[DECODE_PAGE_ID_BYTE] == BUSY_ACQUIRING_PID) { //Check to see that the received serial number in the message buffer matches the serial number argument. uint32_t received_serial_number = ((uint32_t) p_rx_buffer[ANT_MESSAGE_DATA7_OFFSET] << 24 | (uint32_t) p_rx_buffer[ANT_MESSAGE_DATA6_OFFSET] << 16 | (uint32_t) p_rx_buffer[ANT_MESSAGE_DATA5_OFFSET] << 8 | (uint32_t) p_rx_buffer[ANT_MESSAGE_DATA4_OFFSET]); if (received_serial_number == serial_number) { *p_is_serial_match = true; *next_address = p_rx_buffer[ANT_MESSAGE_DATA3_OFFSET]; } else { *p_is_serial_match = false; } return NRF_SUCCESS; } else { return NRF_ERROR_INVALID_PARAM; } } #endif uint32_t asc_decode_confirm_acquire_page(uint32_t serial_number, bool * p_is_serial_match, asc_confirm_acquire_paramters_t * p_params, uint8_t * p_rx_buffer) { if (p_rx_buffer[DECODE_PAGE_ID_BYTE] == CONFIRM_ACQUIRE_PID) { //Confirm that it is the correct device if (((uint8_t) serial_number) == p_rx_buffer[ANT_MESSAGE_DATA3_OFFSET]) { *p_is_serial_match = true; p_params->model_number = p_rx_buffer[ANT_MESSAGE_DATA5_OFFSET] << 8 | p_rx_buffer[ANT_MESSAGE_DATA4_OFFSET] ; p_params->hw_revision = p_rx_buffer[ANT_MESSAGE_DATA6_OFFSET]; p_params->sw_revision = p_rx_buffer[ANT_MESSAGE_DATA7_OFFSET]; } else { *p_is_serial_match = false; } return NRF_SUCCESS; } else { return NRF_ERROR_INVALID_PARAM; } } uint32_t asc_decode_command_page(asc_command_data_t * p_command_data, uint8_t * p_rx_buffer) { if (p_rx_buffer[DECODE_PAGE_ID_BYTE] == COMMAND_PID) { p_command_data->group_number = (p_rx_buffer[ANT_MESSAGE_DATA3_OFFSET] >> 4); p_command_data->command = (asc_commands_t) p_rx_buffer[ANT_MESSAGE_DATA7_OFFSET]; return NRF_SUCCESS; } else { return NRF_ERROR_INVALID_PARAM; } } uint32_t asc_decode_update_data_page(asc_update_data_t * p_update_data, uint8_t * p_rx_buffer) { if (p_rx_buffer[DECODE_PAGE_ID_BYTE] == UPDATE_DATA_PID) { #ifdef TWO_BYTE_SHARED_ADDRESS p_update_data->shared_address = p_rx_buffer[DECODE_SHARED_ADDRESS_BYTE2] << 8 | p_rx_buffer[DECODE_SHARED_ADDRESS_BYTE1]; #else p_update_data->shared_address = p_rx_buffer[DECODE_SHARED_ADDRESS_BYTE]; #endif p_update_data->state = (asc_slave_states_t) p_rx_buffer[ANT_MESSAGE_DATA7_OFFSET]; return NRF_SUCCESS; } else { return NRF_ERROR_INVALID_PARAM; } } uint32_t asc_decode_phone_update_data_page(asc_update_data_t * p_update_data, uint8_t * p_rx_buffer) { if (p_rx_buffer[DECODE_PHONE_PAGE_ID_BYTE] == UPDATE_DATA_PID) { #ifdef TWO_BYTE_SHARED_ADDRESS p_update_data->shared_address = p_rx_buffer[DECODE_PHONE_SHARED_ADDRESS_BYTE2] << 8 | p_rx_buffer[DECODE_PHONE_SHARED_ADDRESS_BYTE1]; #else p_update_data->shared_address = p_rx_buffer[DECODE_PHONE_SHARED_ADDRESS_BYTE1]; #endif p_update_data->master_id = p_rx_buffer[ANT_MESSAGE_DATA4_OFFSET] << 8 | p_rx_buffer[ANT_MESSAGE_DATA3_OFFSET]; p_update_data->state = (asc_slave_states_t) p_rx_buffer[ANT_MESSAGE_DATA7_OFFSET]; return NRF_SUCCESS; } else { return NRF_ERROR_INVALID_PARAM; } } uint32_t asc_decode_request_data_page(asc_request_data_t * p_request_data, uint8_t * p_rx_buffer) { if (p_rx_buffer[DECODE_PAGE_ID_BYTE] == REQUEST_DATA_PID) { #ifdef TWO_BYTE_SHARED_ADDRESS p_request_data->shared_address = p_rx_buffer[DECODE_SHARED_ADDRESS_BYTE2] << 8 | p_rx_buffer[DECODE_SHARED_ADDRESS_BYTE1]; #else p_request_data->shared_address = p_rx_buffer[DECODE_SHARED_ADDRESS_BYTE]; #endif p_request_data->page_id_requested = p_rx_buffer[ANT_MESSAGE_DATA6_OFFSET]; return NRF_SUCCESS; } else { return NRF_ERROR_INVALID_PARAM; } } uint32_t asc_decode_phone_command_page(asc_command_data_t * p_command_data, uint8_t * p_rx_buffer) { if (p_rx_buffer[ANT_MESSAGE_DATA0_OFFSET] == PHONE_COMMAND_PID) { #ifdef TWO_BYTE_SHARED_ADDRESS p_command_data->shared_address = p_rx_buffer[ANT_MESSAGE_DATA2_OFFSET] << 8 | p_rx_buffer[ANT_MESSAGE_DATA1_OFFSET]; #else p_command_data->shared_address = p_rx_buffer[ANT_MESSAGE_DATA1_OFFSET]; #endif p_command_data->master_id = (p_rx_buffer[ANT_MESSAGE_DATA4_OFFSET] << 8) | p_rx_buffer[ANT_MESSAGE_DATA3_OFFSET]; p_command_data->group_number = (p_rx_buffer[ANT_MESSAGE_DATA5_OFFSET] >> 4); p_command_data->command = (asc_commands_t) p_rx_buffer[ANT_MESSAGE_DATA7_OFFSET]; return NRF_SUCCESS; } else { return NRF_ERROR_INVALID_PARAM; } } /** @} */
<reponame>pvormste/graphql-go-tools<gh_stars>0 package document import "github.com/jensneuse/graphql-go-tools/pkg/lexing/position" // EnumValueDefinition as specified in: // http://facebook.github.io/graphql/draft/#EnumValueDefinition type EnumValueDefinition struct { Description ByteSliceReference EnumValue ByteSliceReference DirectiveSet int Position position.Position NextRef int } func (e EnumValueDefinition) NodeSelectionSet() int { panic("implement me") } func (e EnumValueDefinition) NodeInputFieldsDefinition() int { panic("implement me") } func (e EnumValueDefinition) NodeInputValueDefinitions() InputValueDefinitions { panic("implement me") } func (e EnumValueDefinition) NodePosition() position.Position { return e.Position } func (e EnumValueDefinition) NodeValueType() ValueType { panic("implement me") } func (e EnumValueDefinition) NodeValueReference() int { panic("implement me") } func (e EnumValueDefinition) NodeUnionMemberTypes() []int { panic("implement me") } func (e EnumValueDefinition) NodeSchemaDefinition() SchemaDefinition { panic("implement me") } func (e EnumValueDefinition) NodeScalarTypeDefinitions() []int { panic("implement me") } func (e EnumValueDefinition) NodeObjectTypeDefinitions() []int { panic("implement me") } func (e EnumValueDefinition) NodeInterfaceTypeDefinitions() []int { panic("implement me") } func (e EnumValueDefinition) NodeUnionTypeDefinitions() []int { panic("implement me") } func (e EnumValueDefinition) NodeEnumTypeDefinitions() []int { panic("implement me") } func (e EnumValueDefinition) NodeInputObjectTypeDefinitions() []int { panic("implement me") } func (e EnumValueDefinition) NodeDirectiveDefinitions() []int { panic("implement me") } func (e EnumValueDefinition) NodeImplementsInterfaces() ByteSliceReferences { panic("implement me") } func (e EnumValueDefinition) NodeValue() int { panic("implement me") } func (e EnumValueDefinition) NodeDefaultValue() int { panic("implement me") } func (e EnumValueDefinition) NodeFieldsDefinition() FieldDefinitions { panic("implement me") } func (e EnumValueDefinition) NodeArgumentsDefinition() int { panic("implement me") } func (e EnumValueDefinition) NodeAlias() ByteSliceReference { panic("implement me") } func (e EnumValueDefinition) NodeOperationType() OperationType { panic("implement me") } func (e EnumValueDefinition) NodeType() int { panic("implement me") } func (e EnumValueDefinition) NodeVariableDefinitions() []int { return nil } func (e EnumValueDefinition) NodeFields() []int { return nil } func (e EnumValueDefinition) NodeFragmentSpreads() []int { return nil } func (e EnumValueDefinition) NodeInlineFragments() []int { return nil } func (e EnumValueDefinition) NodeName() ByteSliceReference { return e.EnumValue } func (e EnumValueDefinition) NodeDescription() ByteSliceReference { return e.Description } func (e EnumValueDefinition) NodeArgumentSet() int { panic("implement me") } func (e EnumValueDefinition) NodeDirectiveSet() int { return e.DirectiveSet } func (e EnumValueDefinition) NodeEnumValuesDefinition() EnumValueDefinitions { panic("implement me") } type EnumValueDefinitionGetter interface { EnumValueDefinition(ref int) EnumValueDefinition } // EnumValueDefinitions as specified in: // http://facebook.github.io/graphql/draft/#EnumValuesDefinition type EnumValueDefinitions struct { nextRef int currentRef int current EnumValueDefinition } func NewEnumValueDefinitions(nextRef int) EnumValueDefinitions { return EnumValueDefinitions{ nextRef: nextRef, } } func (i *EnumValueDefinitions) HasNext() bool { return i.nextRef != -1 } func (i *EnumValueDefinitions) Next(getter EnumValueDefinitionGetter) bool { if i.nextRef == -1 { return false } i.currentRef = i.nextRef i.current = getter.EnumValueDefinition(i.nextRef) i.nextRef = i.current.NextRef return true } func (i *EnumValueDefinitions) Value() (EnumValueDefinition, int) { return i.current, i.currentRef }
import { Component, OnInit } from '@angular/core'; @Component({ selector: 'app-contact-map', templateUrl: './contact-map.component.html', styleUrls: ['./contact-map.component.scss'] }) export class ContactMapComponent implements OnInit { options: any; overlays: any[]; // To display a marker such as circle // To Get longitude and latitude google maps of Makepe city private latitudeMakepe = 4.06064592274785; private logitudeMakepe = 9.738229178780978; constructor() { } ngOnInit() { this.options = { center: { lat: this.latitudeMakepe, lng: this.logitudeMakepe }, zoom: 15 }; this.overlays = [ new google.maps.Marker({ position: { lat: this.latitudeMakepe + 1, lng: this.logitudeMakepe + 1 }, title: 'Konyaalti' }), new google.maps.Circle({ center: { lat: this.latitudeMakepe + 0.00002, lng: this.logitudeMakepe }, fillColor: 'blue', fillOpacity: 0.15, strokeWeight: 1, radius: 1000 }), ]; } }
<filename>cms/schemas/schema.js // First, we must import the schema creator import createSchema from 'part:@sanity/base/schema-creator'; // Then import schema types from any plugins that might expose them import schemaTypes from 'all:part:@sanity/base/schema-type'; // We import object and document schemas import skillList from './skillList'; import techStack from './techStack'; import jobPosition from './jobPosition'; import positionDetails from './positionDetails'; import socialMedia from './socialMedia'; import personalDetails from './personalDetails'; import blogFeatureFlags from './featureFlags'; import education from './education'; import educationItem from './educationItem'; import projects from './projects/projects'; import tournament from './rollerDerby/tournaments'; import game from './rollerDerby/games'; import league from './rollerDerby/league'; import derbyInfo from './rollerDerby/derbyInfo'; import functions from './quickFunc/functions'; import sitePages from './site/pages'; // Then we give our schema to the builder and provide the result to Sanity export default createSchema({ // We name our schema name: 'default', // Then proceed to concatenate our document type // to the ones provided by any plugins that are installed types: schemaTypes.concat([ educationItem, skillList, techStack, positionDetails, jobPosition, socialMedia, personalDetails, blogFeatureFlags, education, projects, tournament, game, league, derbyInfo, sitePages, functions, ]), });
package mysqlconn import "github.com/go-sql-driver/mysql" const argFmt = "?" type Config = mysql.Config // NewConfig creates a new Config and sets default values. func NewConfig() *Config { return mysql.NewConfig() }
<filename>C2CRIBuildDir/projects/C2C-RI/src/jameleon-test-suite-3_3-RC1-C2CRI/jameleon-core/tst/java/net/sf/jameleon/plugin/junit/BrokeredAttributesTag.java /* Jameleon - An automation testing tool.. Copyright (C) 2003-2006 <NAME> (<EMAIL>) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ package net.sf.jameleon.plugin.junit; /** * Used for testing data-driven attributes. * @jameleon.function name="data-driven-attributes" type="validation" * @jameleon.step Request attributes for this tag. * @jameleon.step Verify the Jameleon framework has set the attributes as requested. * */ public class BrokeredAttributesTag extends JUnitFunctionTag { /** * @jameleon.attribute required="true" contextName="brokeredAttributesStringAttr" **/ protected String myString; /** * @jameleon.attribute required="true" contextName="brokeredAttributesBooleanAttr" **/ protected boolean myBoolean; /** * @jameleon.attribute required="false" contextName="brokeredAttributesOptionalAttr" **/ protected String optionalAttribute; /** * @jameleon.attribute required="false" contextName="brokeredAttributesDefaultAttr" default="this is the default value" **/ protected String defaultAttribute1; /** * @jameleon.attribute required="false" contextName="brokeredAttributesDefaultAttr2" default="this is the default value" **/ protected String defaultAttribute2; /** * @jameleon.attribute contextName="brokeredAttributesDefaultAttr3" default="default value3" **/ protected String defaultAttribute3; /** * @jameleon.attribute **/ protected String value3; /** * @jameleon.attribute default="default value4" **/ protected String defaultAttribute4; /** * @jameleon.attribute **/ protected String value4; public void testBlock() { assertEquals("test succeeded!", myString); assertEquals(true, myBoolean); assertEquals("this is the default value", defaultAttribute2); assertNull("optionalAttribute should be null!", optionalAttribute); assertEquals("no longer default", defaultAttribute1); assertEquals(value3, defaultAttribute3); assertEquals(value4, defaultAttribute4); } }
<gh_stars>0 import { BrowserModule } from '@angular/platform-browser'; import { NgModule } from '@angular/core'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { AppComponent } from './app.component'; import { DatePickerNgmodel } from './date-picker-ngmodel'; import { DatePickerReactiveForms } from './date-picker-reactive-forms'; import { DatePickerDivHostElement } from './date-picker-div-host-element'; import { DatePickerInline} from './date-picker-inline'; import { SkyesDatePickerModule } from '../../projects/skyes-datepicker/src/public-api'; @NgModule({ declarations: [ AppComponent, DatePickerNgmodel, DatePickerReactiveForms, DatePickerDivHostElement, DatePickerInline ], imports: [ BrowserModule, ReactiveFormsModule, FormsModule, SkyesDatePickerModule ], providers: [], bootstrap: [AppComponent] }) export class AppModule { }
#!/bin/bash wget https://bootstrap.pypa.io/get-pip.py python get-pip.py --user python -m pip install -U pip --user flask python -m pip install -U pip --user flask-cors python -m pip install -U pip --user requests python -m pip install -U pip --user websocket-server python -m pip install -U pip --user isodate
package net.sproutlab.kmufood.dialog; import android.app.Dialog; import android.content.Context; import android.content.Intent; import android.net.Uri; import android.view.View; import net.sproutlab.kmufood.R; /** * Created by kde713 on 2016. 9. 7.. */ public class FeedbackDialog extends Dialog implements View.OnClickListener { private final Context c; public FeedbackDialog(Context context) { super(context); this.c = context; setContentView(R.layout.dialog_feedback); findViewById(R.id.btn_contact_email).setOnClickListener(this); findViewById(R.id.btn_contact_github).setOnClickListener(this); findViewById(R.id.btn_contact_kakaotalk).setOnClickListener(this); findViewById(R.id.btn_close).setOnClickListener(this); } @Override public void onClick(View view) { switch (view.getId()) { case R.id.btn_contact_email: c.startActivity(new Intent(Intent.ACTION_SENDTO, Uri.parse("mailto:<EMAIL>"))); dismiss(); break; case R.id.btn_contact_github: c.startActivity(new Intent(new Intent(Intent.ACTION_VIEW).setData(Uri.parse("https://github.com/kde713/kmufood-android")))); dismiss(); break; case R.id.btn_contact_kakaotalk: c.startActivity(new Intent(new Intent(Intent.ACTION_VIEW).setData(Uri.parse("https://open.kakao.com/o/sEe1SqX")))); dismiss(); break; case R.id.btn_close: dismiss(); break; } } }
#!/bin/sh set -e # Add `java -jar /wiremock-standalone.jar` as command if needed if [ "${1#-}" != "$1" ]; then set -- java -cp /var/wiremock/lib/*:/var/wiremock/extensions/* com.github.tomakehurst.wiremock.standalone.WireMockServerRunner "$@" fi # allow the container to be started with `-e uid=` if [ "$uid" != "" ]; then # Change the ownership of /home/wiremock to $uid chown -R $uid:$uid /home/wiremock set -- su-exec $uid:$uid "$@" fi exec "$@"
#!/usr/bin/bash # Copyright (c) 2021. Huawei Technologies Co.,Ltd.ALL rights reserved. # This program is licensed under Mulan PSL v2. # You can use it according to the terms and conditions of the Mulan PSL v2. # http://license.coscl.org.cn/MulanPSL2 # THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, # EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, # MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. # See the Mulan PSL v2 for more details. #################################### #@Author : Jevons #@Contact : 1557927445@qq.com #@Date : 2021-06-21 20:31:43 #@License : Mulan PSL v2 #@Desc : yelp build ##################################### source ${OET_PATH}/libs/locallibs/common_lib.sh function pre_test() { LOG_INFO "Start to prepare the test environment." DNF_INSTALL "yelp-tools yelp" wget https://gitlab.gnome.org/GNOME/yelp-tools/-/blob/master/help/C/yelp-build.page LOG_INFO "End to prepare the test environment." } function run_test() { LOG_INFO "Start to run test." yelp-build html yelp-build.page CHECK_RESULT $? 0 0 "html failed" test -f "highlight.pack.js" CHECK_RESULT $? 0 0 "find html failed" yelp-build cache yelp-build.page CHECK_RESULT $? 0 0 "cache failed" test -f "index.cache" CHECK_RESULT $? 0 0 "find cache failed" yelp-build epub yelp-build.page CHECK_RESULT $? 0 0 "epub failed" test -f "index.epub" CHECK_RESULT $? 0 0 "find epub failed" LOG_INFO "End to run test." } function post_test() { LOG_INFO "Start to restore the test environment." rm -rf highlight.pack.js index.cache index.epub yelp-build.page C.css yelp-build.html yelp.js DNF_REMOVE LOG_INFO "End to restore the test environment." } main "$@"
var group__eth__mac__interface__gr_structARM__DRIVER__ETH__MAC = [ [ "GetVersion", "group__eth__mac__interface__gr.html#a8834b281da48583845c044a81566c1b3", null ], [ "GetCapabilities", "group__eth__mac__interface__gr.html#a9fd725bb058c584a9ced9c579561cdf1", null ], [ "Initialize", "group__eth__mac__interface__gr.html#aa34417c70cb8b43567c59aa530866cc7", null ], [ "Uninitialize", "group__eth__mac__interface__gr.html#adcf20681a1402869ecb5c6447fada17b", null ], [ "PowerControl", "group__eth__mac__interface__gr.html#aba8f1c8019af95ffe19c32403e3240ef", null ], [ "GetMacAddress", "group__eth__mac__interface__gr.html#a02837059933cd04b04bf795a7138f218", null ], [ "SetMacAddress", "group__eth__mac__interface__gr.html#ac640f929dc4d5bde3e4282c75b25c00d", null ], [ "SetAddressFilter", "group__eth__mac__interface__gr.html#a45b879a6df608f582d1866daff715798", null ], [ "SendFrame", "group__eth__mac__interface__gr.html#ac095aea379f23e30a0e51b1f3518ad37", null ], [ "ReadFrame", "group__eth__mac__interface__gr.html#a466b724be2167ea7d9a14569062a8fa8", null ], [ "GetRxFrameSize", "group__eth__mac__interface__gr.html#a3286cc9c7624168b162aa3ce3cbe135e", null ], [ "GetRxFrameTime", "group__eth__mac__interface__gr.html#a8ae5a588bf4055bba3de73cfba78f7e8", null ], [ "GetTxFrameTime", "group__eth__mac__interface__gr.html#acf081f5020f4ef1435bcff7333a70b93", null ], [ "ControlTimer", "group__eth__mac__interface__gr.html#ab6bdbdc7fdfcc52e027201738b88b431", null ], [ "Control", "group__eth__mac__interface__gr.html#a6e0f47a92f626a971c5197fca6545505", null ], [ "PHY_Read", "group__eth__mac__interface__gr.html#a0f2ddb734e4242077275761400b26e35", null ], [ "PHY_Write", "group__eth__mac__interface__gr.html#ac3efe9bdc31c3b1d7fd8eb82bbfb4c13", null ] ];
<reponame>huangshuyuan/BluetoothHelper package top.wuhaojie.bthelper; /** * Created by wuhaojie on 2016/9/10 20:23. */ public class MessageItem { enum TYPE { STRING, CHAR } String text; char[] data; TYPE mTYPE; public MessageItem(String text) { this.text = text; mTYPE = TYPE.STRING; } public MessageItem(char[] data) { this.data = data; mTYPE = TYPE.CHAR; } }
#!/bin/bash FN="hu6800subacdf_2.18.0.tar.gz" URLS=( "https://bioconductor.org/packages/3.10/data/annotation/src/contrib/hu6800subacdf_2.18.0.tar.gz" "https://bioarchive.galaxyproject.org/hu6800subacdf_2.18.0.tar.gz" "https://depot.galaxyproject.org/software/bioconductor-hu6800subacdf/bioconductor-hu6800subacdf_2.18.0_src_all.tar.gz" "https://depot.galaxyproject.org/software/bioconductor-hu6800subacdf/bioconductor-hu6800subacdf_2.18.0_src_all.tar.gz" ) MD5="9e8ec301e066e400564976cd9750297e" # Use a staging area in the conda dir rather than temp dirs, both to avoid # permission issues as well as to have things downloaded in a predictable # manner. STAGING=$PREFIX/share/$PKG_NAME-$PKG_VERSION-$PKG_BUILDNUM mkdir -p $STAGING TARBALL=$STAGING/$FN SUCCESS=0 for URL in ${URLS[@]}; do curl $URL > $TARBALL [[ $? == 0 ]] || continue # Platform-specific md5sum checks. if [[ $(uname -s) == "Linux" ]]; then if md5sum -c <<<"$MD5 $TARBALL"; then SUCCESS=1 break fi else if [[ $(uname -s) == "Darwin" ]]; then if [[ $(md5 $TARBALL | cut -f4 -d " ") == "$MD5" ]]; then SUCCESS=1 break fi fi fi done if [[ $SUCCESS != 1 ]]; then echo "ERROR: post-link.sh was unable to download any of the following URLs with the md5sum $MD5:" printf '%s\n' "${URLS[@]}" exit 1 fi # Install and clean up R CMD INSTALL --library=$PREFIX/lib/R/library $TARBALL rm $TARBALL rmdir $STAGING
#!/bin/bash #SBATCH -p medium #SBATCH -t 23:00:00 #SBATCH -J ld_m1k #SBATCH -N 1 #SBATCH -n 1 #SBATCH -c 20 #SBATCH -o ld_m1k.out #SBATCH -e ld_m1k.err module load intel/mkl/64/2017/2.174 module load openmpi/intel/64/1.10.7 #module load conda/4.3.30 #source activate party Rscript ld_m1k.R