Skip to content

Instantly share code, notes, and snippets.

@aditrades
aditrades / gpu_stats.sh
Created October 8, 2017 12:26 — forked from hitman99/gpu_stats.sh
CloudWatch metrics for GPU on EC2 G3 instance
#!/bin/bash
IFS=', ' read -r -a STATS <<< `nvidia-smi --query-gpu=temperature.gpu,memory.used,memory.free,utilization.gpu,utilization.memory --format=csv,nounits,noheader`
#echo ${STATS[@]}
# Send values to CloudWatch
aws cloudwatch put-metric-data --metric-name Temperature --namespace GPUStats --value ${STATS[0]}
aws cloudwatch put-metric-data --metric-name MemoryUsed --namespace GPUStats --unit Megabytes --value ${STATS[1]}
aws cloudwatch put-metric-data --metric-name MemoryFree --namespace GPUStats --unit Megabytes --value ${STATS[2]}
aws cloudwatch put-metric-data --metric-name GPUUtilization --namespace GPUStats --value ${STATS[3]}
@willshiao
willshiao / aes.go
Last active July 2, 2024 11:48
AES 256-CFB in Node.js, Go, and Python
package main
import (
"crypto/aes"
"crypto/cipher"
"crypto/rand"
"crypto/sha256"
"encoding/base64"
"fmt"
"io"
#!/bin/bash
# Logout current GitHub credentials and remove global user.name, user.email
echo -e "host=github.com\nprotocol=https\n" | git credential-osxkeychain erase
git config --unset-all --global user.name
git config --unset-all --global user.email
@wojteklu
wojteklu / clean_code.md
Last active July 4, 2024 14:58
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@tomysmile
tomysmile / mac-setup-redis.md
Last active June 27, 2024 00:23
Brew install Redis on Mac

type below:

brew update
brew install redis

To have launchd start redis now and restart at login:

brew services start redis
@Shaked
Shaked / 1-cur-popup-blocker.md
Last active November 13, 2015 23:40
Remove ynet ad against popup blockers

Remove ynet ad against popup blockers

If you are using a popup blocker, and you are annoyed by Ynet's message that tells you to disable it, you should follow this guide.

  • Go to: chrome-extension://gighmmpiobklfepjocnamgkkbiglidom/options/index.html
  • Click on Edit and add: @@http://www.ynet.co.il/common/javascript/ads.js. Should look like: Popup Blocker Settings
  • Click on Save
  • Once done, save it and go to www.ynet.co.il and use hard referesh.
@uzysjung
uzysjung / eb.config
Last active January 22, 2020 05:59
increase max connections in elasticbeanstalk
commands:
01limits:
command: echo -e "#commands\nroot soft nofile 65536\nroot hard nofile 65536\n* soft nofile 65536\n* hard nofile 65536" >/etc/security/limits.d/custom.conf
02sysctl:
command: sysctl -w fs.file-max=131072 fs.nr_open=131072 net.ipv4.netfilter.ip_conntrack_max=131072 net.nf_conntrack_max=131072
@pbojinov
pbojinov / README.md
Last active June 24, 2024 05:39
Two way iframe communication- Check out working example here: http://pbojinov.github.io/iframe-communication/

Two way iframe communication

The main difference between the two pages is the method of sending messages. Recieving messages is the same in both.

Parent

Send messages to iframe using iframeEl.contentWindow.postMessage Recieve messages using window.addEventListener('message')

iframe