Tag Archives: tutorial
Programming with FASM – writing to file.
In this simple example, I will show how to write a file using the assembly programming language with FASM, known as flat assembler. You can use the FASM editor with the FASMW.EXE executable. Open this editor and use this commented source code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | ;define format of exe file format pe console 4.0 ;include file WIN32AX ;http://flatassembler.net/docs.php?article=win32 include 'INCLUDE/WIN32AX.INC' ; define data for code .data ;this will be the filename of file filename db 'file.txt',0 ; this string will be write on the file buffer_text db 'This is a test by Catalin!' ; this is the size for WriteFile based on buffer_text buffer_size = $ - buffer_text ; define a space bytes_to_write dd ? ; the code for running .code main: invoke CreateFile,filename, GENERIC_WRITE, 0, 0, 4, FILE_ATTRIBUTE_NORMAL, 0 ;https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-writefile invoke WriteFile, eax, buffer_text, buffer_size, bytes_to_write, 0 ;https://learn.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-exitprocess invoke ExitProcess, 0 .end main |
Each step is describe in the source code. Run and test with… Read More »
PowerShell tips – part 026.
In this article tutorial, I will show you how to use a function from a PowerShell script. Create a script named: Get-NetworkConnectionProcess.ps1. Add this source code to your script:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | function Get-NetworkConnectionProcess { [CmdletBinding()] param ( [ValidateSet( 'Closed', 'CloseWait', 'Closing', 'DeleteTCB', 'Established', 'FinWait1', 'FinWait2', 'LastAck', 'Listen', 'SynReceived', 'SynSent', 'TimeWait')] [string]$State = 'Established' ) process { $TCPConnections = Get-NetTCPConnection -State $State | Select-Object -Property LocalPort, OwningProcess $Filter = "ProcessId=" + ($($TCPConnections.OwningProcess) -join " or ProcessId=") Write-Verbose "ProcessIds are $Filter" $TCPProcessesArguments = @{ ClassName = 'Win32_Process' Filter = $Filter Property = 'ProcessId', 'Name', 'CommandLine' } $TCPProcesses = Get-CimInstance @TCPProcessesArguments | Select-Object -Property ProcessId, Name, CommandLine foreach ($TCPConnection in $TCPConnections) { Write-Verbose "Processing $($TCPConnection.LocalPort)" $TCPProcess = $TCPProcesses | Where-Object -Property ProcessId -EQ -Value $TCPConnection.OwningProcess [PSCustomObject]@{ Port = $TCPConnection.LocalPort ProcessName = $TCPProcess.Name ProcessCmd = $TCPProcess.CommandLine } } } } |
Use the dot sourcing operator (.) to load the function into your PowerShell session, like this:
1 | . .\Get-NetworkConnectionProcess.ps1 |
The command will load the function and once… Read More »
Google Apps Script – get notification from GitHub account – part 053.
You need to have a GitHub account. Create a new token by following these steps: Go to your GitHub settings. Click on “Developer settings”. Click on “Personal access tokens”. Click on “Generate new token”. Select the scopes you want the token to have (in this case, make sure to select the “notifications” scope). Click on… Read More »
Windows – Chrome settings with chrome://flags .
Open the Chrome browser and on the address bar write this: chrome://flags. This will let you make changes to the Chrome browser by enabling and after these settings, you need to restart the browser then you can use it. Let’s see what features can be used: Parallel downloading Enable parallel downloading to accelerate download speed.… Read More »
Windows – install and use chocolatey.
Chocolatey is a software management solution that allows you to manage 100% of your software, anywhere you have Windows, with any endpoint management tool. This can be easily installed on Powershell with this command:
1 | Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1')) |
After installation you can use the help to see how can be used:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | choco help Chocolatey v1.2.1 This is a listing of all of the different things you can pass to choco. DEPRECATION NOTICE The shims `chocolatey`, `cinst`, `clist`, `cpush`, `cuninst` and `cup` are deprecated. We recommend updating all scripts to use their full command equivalent as these will be removed in v2.0.0 of Chocolatey. Options and Switches -v, --version Version - Prints out the Chocolatey version. Available in 0.9.9+. Commands * apikey - retrieves, saves or deletes an apikey for a particular source * config - Retrieve and configure config file settings * export - exports list of currently installed packages * feature - view and configure choco features * features - view and configure choco features (alias for feature) * find - searches remote or local packages (alias for search) * help - displays top level help information for choco * info - retrieves package information. Shorthand for choco search pkgname --exact --verbose * install - installs packages using configured sources * list - lists remote or local packages * new - creates template files for creating a new Chocolatey package * outdated - retrieves information about packages that are outdated. Similar to upgrade all --noop * pack - packages nuspec, scripts, and other Chocolatey package resources into a nupkg file * pin - suppress upgrades for a package * push - pushes a compiled nupkg to a source * search - searches remote or local packages * setapikey - retrieves, saves or deletes an apikey for a particular source (alias for apikey) * source - view and configure default sources * sources - view and configure default sources (alias for source) * template - get information about installed templates * templates - get information about installed templates (alias for template) * uninstall - uninstalls a package * unpackself - re-installs Chocolatey base files * upgrade - upgrades packages from various sources Please run chocolatey with `choco command -help` for specific help on each command. ... |
If you want to install an… Read More »
Blender 3D – python script to create ovoid using the math formula for ovoid.
This Python script for Blender 3D creates an ovoid model using the math formula for ovoid:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | import bpy import math # Define the parameters of the ovoid a = 1.9 b = 1.5 c = 1.5 # Define the number of vertices in each direction n_long = 32 n_lat = 16 # Create a new mesh mesh = bpy.data.meshes.new(name="Ovoid") # Create the vertices verts = [] for j in range(n_lat): lat = (j / (n_lat - 1)) * math.pi for i in range(n_long): lon = (i / (n_long - 1)) * 2 * math.pi x = a * math.sin(lat) * math.cos(lon) y = b * math.sin(lat) * math.sin(lon) z = c * math.cos(lat) verts.append((x, y, z)) # Create the faces faces = [] for j in range(n_lat - 1): for i in range(n_long - 1): v1 = j * n_long + i v2 = j * n_long + i + 1 v3 = (j + 1) * n_long + i + 1 v4 = (j + 1) * n_long + i faces.append((v1, v2, v3, v4)) # Create the mesh and object mesh.from_pydata(verts, [], faces) obj = bpy.data.objects.new(name="Ovoid", object_data=mesh) # Add the object to the scene scene = bpy.context.scene scene.collection.objects.link(obj) |
Artificial intelligence – about artificial intelligence – part 002.
Recently, there has been opposition in the media regarding the emergence of a danger related to the influence of artificial intelligence in the human environment. I would like to express my opinion on this subject and I would emphasize that artificial intelligence is a machine. The danger does not exist and the influence regarding the… Read More »