This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Create WebRTC peer and setup event handlers | |
| let peer = new RTCPeerConnection(iceConfig) | |
| // Subject for the websocket signalling server | |
| let socketSubject = Observable.webSocket({ | |
| // deserialize each binary message received | |
| resultSelector: e => deserialize(e.data) | |
| }) | |
| // Filter for only icecandidate messages | |
| .filter(msg => msg && msg.header && msg.header.event === 'icecandidate' && msg.body && msg.body.candidate) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| clear | |
| ############## | |
| # Am I root? # | |
| ############## | |
| if [ "x$(id -u)" != 'x0' ]; then | |
| echo 'Error: this script can only be executed by root.' | |
| echo 'Try re-run the script after switched to root account by type "sudo su"' | |
| exit 1 | |
| fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Original source: https://openmp.llvm.org/ | |
| # 1- Clone the repo (~ 1Gb) | |
| git clone --depth 1 https://github.com/llvm/llvm-project.git | |
| cd llvm-project | |
| mkdir build && cd build | |
| # 2- Make sure clang & clang++ are both installed (I believe xcode should be installed as well), you'll some space (~ 16Gb) | |
| cmake ../llvm -DLLVM_ENABLE_PROJECTS=openmp -DCMAKE_C_COMPILER=$(which clang) -DCMAKE_CXX_COMPILER=$(which clang++) | |
| make | |
| # 3- (Optional) Running tests | |
| make check-all |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * VolleySingleton | |
| * | |
| * This is just a wrapper around [VolleyPlus](https://github.com/DWorkS/VolleyPlus) library (tested with v0.1.4) | |
| * You can update the UI without using AsyncTask neither runOnUiThread | |
| * It comes with caching and full image caching without third party library, included options to clear cache | |
| * It doesn't depend on any other libraries and you can send any type of request (String, JSON...) | |
| * It works for both Java and Groovy (it should works for Kotlin as well) | |
| * Tested on SdkVersion v19 up to v28. | |
| */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import os, csv, requests, datetime, urllib, re | |
| from bs4 import BeautifulSoup | |
| # from dateutil.parser import parse # if you want to parse datetime | |
| # This script allows you to grab results from your wordpress website if you're using "Quiz And Survey" plugin. | |
| wp_host = 'https://your-wordpress-website.com' | |
| wp_login = f"{wp_host}/login" | |
| wp_admin = f"{wp_host}/wp-admin/" | |
| wp_quiz = f"{wp_host}/wp-admin/admin.php?page=mlw_quiz_results&qmn_order_by=time_taken_real" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # This script allows to upgrade postgres database server (e.g. 9.5 to 9.6) | |
| # References: | |
| #https://gorails.com/guides/upgrading-postgresql-version-on-ubuntu-server | |
| #https://stackoverflow.com/questions/13733719/postgresql-which-version-of-postgresql-am-i-running/54514786#54514786 | |
| #https://stackoverflow.com/questions/46687645/upgrade-postgresql-from-9-6-to-10-0-on-ubuntu-16-10 | |
| #https://stackoverflow.com/questions/47029055/how-do-i-upgrade-my-postgresql-9-5-to-postgresql-10-on-ubuntu-16-04 | |
| #https://askubuntu.com/questions/831292/how-do-i-install-postgresql-9-6-on-any-ubuntu-version | |
| #https://chartio.com/resources/tutorials/how-to-view-which-postgres-version-is-running/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Groovy from/to Json conversion | |
| import groovy.json.* | |
| // Object to Json | |
| class Version { | |
| int id | |
| } | |
| class User { | |
| String className = this.class.simpleName.toLowerCase() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $users = file_get_contents('https://jsonplaceholder.typicode.com/users'); | |
| $gz = base64_encode(gzencode($users)); | |
| if (!$gz){ | |
| die('content contains non base64 alpha'); | |
| } | |
| echo $gz; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /* | |
| You should first install phpml library with composer: | |
| ``` | |
| composer require php-ai/php-ml | |
| ``` | |
| then create in the same directory of vendor a file (e.g. `index.php`) with this content. | |
| */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Grapes([ | |
| @Grab('org.slf4j:slf4j-simple:1.7.25'), | |
| @Grab('io.github.http-builder-ng:http-builder-ng-okhttp:1.0.4') | |
| ]) | |
| import groovyx.net.http.OkHttpBuilder | |
| import groovyx.net.http.OkHttpEncoders | |
| import groovyx.net.http.MultipartContent | |
| import static groovyx.net.http.HttpBuilder.configure |