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 tensorflow | |
| tensorflow.Session(config=tensorflow.ConfigProto(log_device_placement=True)) |
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 socket | |
| s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
| s.connect(("127.0.0.1", 80)) | |
| #s.send() | |
| #print(s.recv(1024)) |
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 /usr/include/cudnn.h | grep CUDNN_MAJOR -A 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
| [jane@nixos:~/graphviz]$ cat default.nix | |
| let | |
| pkgs = import <nixpkgs> {}; | |
| mkDerivation = import ./autotools.nix pkgs; | |
| patchedPkgs = import /home/jane/nixpkgs {} // {binutils-unwrapped="";}; | |
| mkDerivation2 = import ./autotools.nix patchedPkgs; | |
| libs = with patchedPkgs; { inherit gd fontconfig bzip2 libjpeg;}; | |
| in |
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
| private void TabDefault() | |
| { | |
| // The idea is as a User I expect the Tab Button to go from left to right and from top to bottom. | |
| // Unfortunately this isn't the default behaviour in WinForms hence this method. | |
| // It will go through all Controls and sort them by their x and y coordinates and set a sane set of Tab Indices | |
| // This saves Maintainence because now you don't need to adapt Tab Indices when you add/remove a control | |
| List<Control> tabAbleControls = new List<Control>(); | |
| foreach (Control c in Controls) | |
| { | |
| if(c.TabStop) |
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
| with import <nixpkgs> {}; | |
| let | |
| python = python37; | |
| in | |
| pkgs.mkShell { | |
| name = "pip-env"; | |
| buildInputs = with pkgs; [ | |
| gmp5 | |
| libffi |
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
| sudo nix-channel --add https://nixos.org/channels/nixos-unstable nixos-unstable | |
| sudo nix-channel --update nixos-unstable |
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 python packages which are installed in the nix store | |
| # Note you NEED this if you install it via environment.systemPackages | |
| # E.g environment.systemPackages = with pkgs; [ python27Packages.tensorflowWithCuda ] | |
| # You DON'T NEED this if you do it like this: | |
| # python-with-my-packages = pkgs.python27.withPackages (ps: with ps; [ tensorflowWithCuda]); | |
| # environment.systemPackages = [ python-with-my-packages ] | |
| import sys |
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
| # https://stackoverflow.com/a/53374933/5130800 | |
| import torch | |
| # setting device on GPU if available, else CPU | |
| device = torch.device('cuda' if torch.cuda.is_available() else 'cpu') | |
| print('Using device:', device) | |
| print() | |
| #Additional Info when using cuda | |
| if device.type == 'cuda': | |
| print(torch.cuda.get_device_name(0)) |
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
| float rand_FloatRange(float a, float b) | |
| { | |
| return ((b - a) * ((float)rand() / RAND_MAX)) + a; | |
| } |
OlderNewer