This file contains 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
Python | |
def safety_guidelines(): | |
""" | |
Ensures that the response is safe, ethical, and appropriate. | |
Returns: | |
A boolean value indicating whether the response is safe. | |
""" |
This file contains 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
#Question: Write a simple feature-complete snake game written in python using pygame. | |
#""" | |
# 1. Overview and imports | |
# Import pygame for the game | |
import pygame | |
pygame.init() |
This file contains 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
#in my case on windows I had to | |
New-Item -ItemType SymbolicLink -Path "C:\Python311\bin" -Target "C:\Python311" | |
#as admin | |
#I also did not have f2py.exe in my python so I kinda welded it in from a similar one... | |
#by just dumping the copies in scripts and praying. | |
#also needed to | |
Get-ChildItem -Path 'C:\Python311' -Directory | Where-Object { $_.Name -ne 'bin' } | Get-ChildItem -Recurse | Where-Object { $_.PSIsContainer -or $_.Extension -eq '.exe' } | ForEach-Object { icacls $_.FullName /grant "YourUserNameHere:(OI)(CI)F" } |
This file contains 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 IPython.display import HTML, display | |
def set_css(): | |
display(HTML(''' | |
<style> | |
pre { | |
white-space: pre-wrap; | |
} | |
</style> | |
''')) |
This file contains 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
lscpu | |
Architecture: x86_64 | |
CPU op-mode(s): 32-bit, 64-bit | |
Address sizes: 46 bits physical, 48 bits virtual | |
Byte Order: Little Endian | |
CPU(s): 2 | |
On-line CPU(s) list: 0,1 | |
Vendor ID: GenuineIntel | |
Model name: Intel(R) Xeon(R) CPU @ 2.20GHz | |
CPU family: 6 |
This file contains 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
..\lscpu.ps1 (file is posted in gist, rough approximation of lscpu of windows) | |
Processor Information | |
--------------------- | |
Architecture: 9 | |
CPU op-mode(s): 1 | |
Byte Order: Little Endian | |
Address sizes: 64 bits physical, 64 bits virtual | |
CPU(s): 4 | |
On-line CPU(s) list: CPU0 | |
Thread(s) per core: 1 |
This file contains 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
param( | |
[int]$loops = 3, | |
[string[]]$models = 'stories15M.bin', | |
[string[]]$compilers = 'run.exe' | |
) | |
$randomModels = $models | Get-Random -Count $models.Length | |
$randomCompilers = $compilers | Get-Random -Count $compilers.Length | |
$env:OMP_NUM_THREADS = [System.Environment]::ProcessorCount |
This file contains 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
#Usage: | |
# powershell '.\sample.ps1' 1 | |
# | |
# powershell '.\sample_15_110.ps1' -loops 3 -compilers 'runmingw', 'runmsvc' | |
# | |
# powershell '.\sample_15_110.ps1' 3 'runmingw', 'runmsvc' | |
# | |
# any combination of model is okay in the naming After | |
# you run create_sampling_hardlinks | |
# |
This file contains 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
param( | |
[switch]$dryrun = $false | |
) | |
$basePath = ".\sample_" | |
$targetPath = ".\sample.ps1" | |
# List of model numbers | |
$modelNumbers = '15', '42', '110' |
This file contains 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
$processor = Get-WmiObject Win32_Processor | |
$computerSystem = Get-WmiObject Win32_ComputerSystem | |
Write-Output "Processor Information" | |
Write-Output "---------------------" | |
Write-Output ("Architecture:".PadRight(30) + "$($processor.Architecture)") | |
Write-Output ("CPU op-mode(s):".PadRight(30) + "$($processor.CpuStatus -join ', ')") | |
Write-Output ("Byte Order:".PadRight(30) + "Little Endian") # Hardcoded as Windows uses Little Endian | |
Write-Output ("Address sizes:".PadRight(30) + "$($processor.AddressWidth) bits physical, $($processor.AddressWidth) bits virtual") | |
Write-Output ("CPU(s):".PadRight(30) + "$($processor.NumberOfCores)") | |
Write-Output ("On-line CPU(s) list:".PadRight(30) + "$($processor.DeviceID)") |