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
# Install GPUtil | |
pip install gputil | |
# Create a Python script (e.g., check_gpu.py) | |
import GPUtil | |
try: | |
gpus = GPUtil.getAvailable(order='first', limit=8, maxLoad=0.5, maxMemory=0.5) | |
if gpus: |
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
$ cat ~/.crc/crc.log | |
time="2021-07-16T15:42:49+05:30" level=debug msg="CodeReady Containers version: 1.29.1+bc5f4409\n" | |
time="2021-07-16T15:42:49+05:30" level=debug msg="OpenShift version: 4.7.18 (embedded in executable)\n" | |
time="2021-07-16T15:42:49+05:30" level=debug msg="Running 'crc setup'" | |
time="2021-07-16T15:42:49+05:30" level=debug msg="Checking if systemd-resolved.service is running" | |
time="2021-07-16T15:42:49+05:30" level=debug msg="Running 'systemctl status systemd-resolved.service'" | |
time="2021-07-16T15:42:49+05:30" level=debug msg="Command failed: exit status 3" | |
time="2021-07-16T15:42:49+05:30" level=debug msg="stdout: * systemd-resolved.service - Network Name Resolution\n Loaded: loaded (/usr/lib/systemd/system/systemd-resolved.service; disabled; vendor preset: disabled)\n Active: inactive (dead)\n Docs: man:systemd-resolved.service(8)\n https://www.freedesktop.org/wiki/Software/systemd/resolved\n https://www.freedesktop.org/wiki/Software/systemd/writing-network-configur |
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
$ cat ~/.crc/crc.log | |
time="2021-07-16T14:08:36+05:30" level=debug msg="CodeReady Containers version: 1.29.1+bc5f4409\n" | |
time="2021-07-16T14:08:36+05:30" level=debug msg="OpenShift version: 4.7.18 (embedded in executable)\n" | |
time="2021-07-16T14:08:36+05:30" level=debug msg="Running 'crc version'" | |
time="2021-07-16T14:08:38+05:30" level=debug msg="No new version available. The latest version is 1.29.1" | |
time="2021-07-16T14:08:44+05:30" level=debug msg="CodeReady Containers version: 1.29.1+bc5f4409\n" | |
time="2021-07-16T14:08:44+05:30" level=debug msg="OpenShift version: 4.7.18 (embedded in executable)\n" | |
time="2021-07-16T14:08:44+05:30" level=debug msg="Running 'crc setup'" | |
time="2021-07-16T14:08:49+05:30" level=debug msg="Checking if systemd-resolved.service is running" | |
time="2021-07-16T14:08:49+05:30" level=debug msg="Running 'systemctl status systemd-resolved.service'" |
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
Verifying my Blockstack ID is secured with the address 1NLJD3ZMNrkAgDsLSvhzQpK1FsGsVULKX4 https://explorer.blockstack.org/address/1NLJD3ZMNrkAgDsLSvhzQpK1FsGsVULKX4 |
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
function getMenuById(menu, id) { | |
if (menu.name == id){ | |
return menu; | |
} | |
if (menu.children) { | |
for (let key in menu.children) { | |
// console.log(menu.id, ' : ', menu.children[key].name); | |
if (menu.children[key].name === id) { | |
return menu.children[key]; | |
} |
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
// Example http://stackoverflow.com/questions/30916031/lodash-deepflatten-array-of-objects | |
function getPeople(persons){ | |
var result = []; | |
_.each(persons, function(person){ | |
result.push({name: person.name, age: person.age}); | |
person.children && (result = _.union(result,getPeople(person.children))) | |
}); | |
return result | |
} |
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
// Refrence http://stackoverflow.com/questions/18817336/golang-encrypting-a-string-with-aes-and-base64 | |
package main | |
import ( | |
"crypto/aes" | |
"crypto/cipher" | |
"crypto/rand" | |
"encoding/base64" | |
"errors" | |
"fmt" |
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
// Ref: http://stackoverflow.com/questions/25141139/toggle-class-with-ng-click-on-several-elements | |
module.directive('toggleClass', function() { | |
return { | |
restrict: 'A', | |
link: function(scope, element, attrs) { | |
element.bind('click', function() { | |
element.toggleClass(attrs.toggleClass); | |
}); | |
} | |
}; |
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
.directive('draggable', function($document) { | |
return function(scope, element, attr) { | |
var startX = 0, startY = 0, x = 0, y = 0; | |
element.on('mousedown', function(event) { | |
// Prevent default dragging of selected content | |
event.preventDefault(); | |
startX = event.screenX - x; | |
startY = event.screenY - y; | |
$document.on('mousemove', mousemove); | |
$document.on('mouseup', mouseup); |
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
var excelbuilder = require('msexcel-builder'); | |
// Create a new workbook file in current working-path | |
var workbook = excelbuilder.createWorkbook('./', 'sample.xlsx') | |
// Create a new worksheet with 10 columns and 12 rows | |
var sheet1 = workbook.createSheet('sheet1', 10, 12); | |
var sheet2 = workbook.createSheet('sheet2', 10, 12); | |
var sheet3 = workbook.createSheet('sheet3', 10, 12); |
NewerOlder