Skip to content

Instantly share code, notes, and snippets.

View lozhn's full-sized avatar

Nikita Lozhnikov lozhn

View GitHub Profile
@ThioJoe
ThioJoe / Allocate-GPUs-VM.ps1
Created January 5, 2024 19:39
PowerShell script to allocate and pass through GPU to Hyper-V Virtual Machine
# Script to easily set resource allocation for GPUs to be passed through into a Hyper-V VM
#
# Author: ThioJoe / https://github.com/thiojoe
#
### Instructions for copying drivers to VM - Will likely need to do this before running this script
# NOTE: Instead of manually copying the files, if you have an Nvidia GPU you can use my other script called "Copy-GPU-Drivers-VM.ps1" to do it automatically
# 1. Open C:\Windows\System32 on host machine and copy any files beginning with "nv" (Except nvspinfo.exe and NvAgent.dll , which are unrelated)
# 2. Place those files into the System32 folder on the VM
# 3. On the VM, create the following directory: C:\Windows\System32\HostDriverStore\FileRepository
# 4. For Nvidia GPUs, open C:\Windows\System32\DriverStore\FileRepository, copy any folders beginning with "nv_" (The number of folders should match the number of GPUs, or at least number of different models of GPU)
@kconner
kconner / macOS Internals.md
Last active June 27, 2024 18:48
macOS Internals

macOS Internals

Understand your Mac and iPhone more deeply by tracing the evolution of Mac OS X from prelease to Swift. John Siracusa delivers the details.

Starting Points

How to use this gist

You've got two main options:

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@lolzballs
lolzballs / HelloWorld.java
Created March 22, 2015 00:21
Hello World Enterprise Edition
import java.io.FileDescriptor;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintStream;
public class HelloWorld{
private static HelloWorld instance;
public static void main(String[] args){
instantiateHelloWorldMainClassAndRun();
@albertstill
albertstill / enigma_machine.rb
Last active February 25, 2021 18:46
Understand how the Enigma machine works with 30 lines of Ruby
Plugboard = Hash[*('A'..'Z').to_a.sample(20)]
Plugboard.merge!(Plugboard.invert)
Plugboard.default_proc = proc { |_, key| key }
def build_a_rotor
Hash[('A'..'Z').zip(('A'..'Z').to_a.shuffle)]
end
ROTOR_1, ROTOR_2, ROTOR_3 = build_a_rotor, build_a_rotor, build_a_rotor
@staltz
staltz / introrx.md
Last active June 29, 2024 15:58
The introduction to Reactive Programming you've been missing
@gimenete
gimenete / gist:53704124583b5df3b407
Last active July 31, 2020 16:20
Animated rootViewController transition
// put this in your AppDelegate
- (void)changeRootViewController:(UIViewController*)viewController {
if (!self.window.rootViewController) {
self.window.rootViewController = viewController;
return;
}
UIView *snapShot = [self.window snapshotViewAfterScreenUpdates:YES];
[viewController.view addSubview:snapShot];
self.window.rootViewController = viewController;
@bugcloud
bugcloud / AFHTTPRequestOperationManager+Timeout.m
Created January 9, 2014 03:10
[AFNetworking] AFHTTPRequestOperationManagerを使うときにタイムアウト時間を設定する ref: http://qiita.com/bugcloud/items/80ea9a4da4624ef2391f
#import "AFHTTPRequestOperationManager+Timeout.h"
@implementation AFHTTPRequestOperationManager (TimeoutCategory)
- (AFHTTPRequestOperation *)GET:(NSString *)URLString
parameters:(NSDictionary *)parameters
timeoutInterval:(NSTimeInterval)timeoutInterval
success:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure
{
@redVi
redVi / ru.yml
Created November 13, 2013 10:05
localization file for Jekyll (_locales/ru.yml)
ru:
date:
abbr_day_names:
- Вс
- Пн
- Вт
- Ср
- Чт
- Пт
- Сб
@nikcub
nikcub / README.md
Created October 4, 2012 13:06
Facebook PHP Source Code from August 2007