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
| from __future__ import print_function | |
| import random | |
| import sys | |
| class CompatibleRandom(random.Random): | |
| # Inspired by https://stackoverflow.com/a/55800424/119527 | |
| def seed(self, a): | |
| if sys.version_info >= (3, 2): | |
| super(CompatibleRandom, self).seed(a, version=1) | |
| else: |
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
| # Put this in your .bashrc or .bash_aliases | |
| # List virtual envs | |
| function list-virtualenvs() { | |
| for d in *; do | |
| if [[ -d "${d}" && -f "${d}/bin/activate" ]]; then | |
| echo "${d}" | |
| fi | |
| done | |
| } |
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
| #!/bin/bash | |
| PATHS='*.go internal' | |
| # Run from project root | |
| cd "$(dirname "${BASH_SOURCE[0]}")" | |
| output="$(gofmt -l $PATHS)" | |
| if [ ! -z "$output" ]; then | |
| echo -e "The following files are not properly formatted:\n" |
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
| #!/usr/bin/env/python3 | |
| import math | |
| def round_down(n, d=8): | |
| # https://stackoverflow.com/a/43533589/119527 | |
| d = 10 ** d | |
| return math.floor(n * d) / d | |
| def human_size(n, decimal_places=2): | |
| n = float(n) |
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
| #!/usr/bin/env python3 | |
| import sys | |
| from ctypes import * | |
| assert sys.version_info >= (3,5) | |
| class Struct(LittleEndianStructure): | |
| _fields_ = [ | |
| ('a', c_uint32), | |
| ('b', c_uint32), |
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
| using System; | |
| using System.Text; | |
| using System.Threading; | |
| using System.Windows.Forms; | |
| using WinformsExceptions; | |
| static class Program | |
| { | |
| /// <summary> |
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 time | |
| import struct | |
| f = open(r'\\.\pipe\NPtest', 'r+b', 0) | |
| i = 1 | |
| while True: | |
| s = 'Message[{0}]'.format(i).encode('ascii') | |
| i += 1 | |
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
| #!/bin/bash | |
| if [[ $# -lt 2 ]]; then | |
| echo "Usage: `basename $0` oldrepo newrepo" | |
| exit 1 | |
| fi | |
| # http://stackoverflow.com/q/1848415/ | |
| OLDREPO=${1%/} | |
| NEWREPO=$2 |
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
| #!/usr/bin/env python3 | |
| from __future__ import print_function | |
| from tempfile import TemporaryFile | |
| from binascii import hexlify | |
| from ctypes import * | |
| class StructHelper(object): | |
| def __get_value_str(self, name, fmt='{}'): | |
| val = getattr(self, name) |
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
| Nov 28 21:24:06.432882 kernel: radeon 0000:01:00.0: ring 0 stalled for more than 10092msec | |
| Nov 28 21:24:06.441917 kernel: radeon 0000:01:00.0: GPU lockup (current fence id 0x0000000001ff9744 last fence id 0x0000000001ff9755 on ring 0) | |
| Nov 28 21:24:06.455092 kernel: radeon 0000:01:00.0: ring 4 stalled for more than 10104msec | |
| Nov 28 21:24:06.455374 kernel: radeon 0000:01:00.0: GPU lockup (current fence id 0x000000000100a400 last fence id 0x000000000100a401 on ring 4) | |
| Nov 28 21:24:06.655161 kernel: radeon 0000:01:00.0: ring 3 stalled for more than 10080msec | |
| Nov 28 21:24:06.655451 kernel: radeon 0000:01:00.0: GPU lockup (current fence id 0x0000000000d334fd last fence id 0x0000000000d3350e on ring 3) | |
| Nov 28 21:24:06.935108 kernel: radeon 0000:01:00.0: ring 0 stalled for more than 10596msec | |
| Nov 28 21:24:06.935390 kernel: radeon 0000:01:00.0: GPU lockup (current fence id 0x0000000001ff9744 last fence id 0x0000000001ff9755 on ring 0) | |
| Nov 28 21:24:06.959090 kernel: radeon 0000:01:00.0: ring 4 stalled for more than 106 |