Skip to content

Instantly share code, notes, and snippets.

@gimmi
gimmi / Microsoft.PowerShell_profile.ps1
Last active September 7, 2023 12:49
Settings for CMD and PowerShell
# Edit profile with the following command
# notepad $PROFILE
function prompt {
$Location = Get-Location
Write-Host -Object $Location.Path -ForegroundColor DarkGray
'>' * $NestedPromptLevel + '> '
}
Invoke-Command -ScriptBlock {
@jlblancoc
jlblancoc / delete_build_temps.bat
Created November 28, 2013 21:54
Batch (.BAT) script (Windows) to delete all temporary files after compiling a project with Microsoft Visual Studio (Visual C++) or GCC. It finds and removes (recursively in the given directory trees), all files that match any of: *.obj, *.o, *.pch, *.pdb, *.ilk, *.idb, *.gch
REM =======================================================================
REM Batch (.BAT) script (Windows) to delete all temporary files after
REM compiling a project with Microsoft Visual Studio (Visual C++) or GCC.
REM
REM Warning: It also deletes the debug databases, needed to "step into"
REM from a debugger. These files may be really *large*, but if you think
REM you will need them, remove the file for "*.pdb" below.
REM
REM Usage:
REM - Open a terminal (Windows-key + R , type "cmd", press ENTER)
@ptheywood
ptheywood / gs-windows.md
Last active April 18, 2024 14:53
Instructions for PDF compression via Ghostscript on Windows

Ghostscript PDF compression on Windows

Installation

  1. Download and install Ghostscript for windows (http://downloads.ghostscript.com/public/gs916w32.exe)
  2. Optional - Add the ghostscript directory to the path environment variable
    • Control Panel > System > Advanced System Settings > Environment Variables
    • Add ;C:\Program Files (x86)\gs\gs9.16\bin to th end of the PATH variable

Usage

@JayRaparla
JayRaparla / batch.bat
Last active April 5, 2024 09:30
batch scripts fundamentals and examples
## list available environment variables
SET
#Useful dynamic variables
%CD% %DATE% %TIME% %RANDOM% %ERRORLEVEL% %CMDEXTVERSION% %CMDCMDLINE% %HIGHESTNUMANODENUMBER%
#The environmental variable %ERRORLEVEL% contains the return code of the last executed program or script.
IF %ERRORLEVEL% NEQ 0 (
REM do something here to address the error
)
# To execute a follow-on command after sucess, we use the && operator:
@rkeithhill
rkeithhill / posh-git_config.ps1
Last active February 26, 2023 19:27
Config file for posh-git.
# Import Posh-Git and configure Git prompt
Import-Module posh-git
#Import-Module ~\GitHub\dahlbyk\posh-git\src\posh-git.psd1
#Import-Module ~\GitHub\dahlbyk\posh-git\out\posh-git\1.0.0\posh-git.psd1
# Windows PowerShell doesn't parse `e or `u escape sequences in DQ strings. I added that support to the PS parser in 6.0
if ($PSVersionTable.PSVersion.Major -lt 6) {
$global:GitPromptSettings.WindowTitle = {
param($GitStatus, [bool]$IsAdmin)
@thomasantony
thomasantony / greyscale.py
Created April 12, 2017 21:22
A Python script for batch converting images to greyscale
"""Batch convert images to greyscale [by Thomas Antony].
Install dependencies:
pip install pillow docopt
Note: If you do not provide an output path, the generated files will be saved
in a folder named "Converted"
Usage:
greyscale.py <in_path> [<out_path>]
@ahmed-musallam
ahmed-musallam / compress_pdf.md
Last active July 2, 2024 09:52
How to compress PDF with ghostscript

How to compress PDF using ghostscript

As a developer, it bothers me when someone sends me a large pdf file compared to the number of pages. Recently, I recieved a 12MB scanned document for just one letter-sized page... so I got to googlin, like I usually do, and found ghostscript!

to learn more abot ghostscript (gs): https://www.ghostscript.com/

What we are interested in, is the gs command line tool, which provides many options for manipulating PDF, but we are interested in compressign those large PDF's into small yet legible documents.

credit goes to this answer on askubuntu forum: https://askubuntu.com/questions/3382/reduce-filesize-of-a-scanned-pdf/3387#3387?newreg=bceddef8bc334e5b88bbfd17a6e7c4f9

@111000101
111000101 / xmapp-replace-mariadb-with-mysql.md
Created October 14, 2017 03:03 — forked from odan/xmapp-replacing-mariadb-with-mysql.md
XAMPP - Replace MariaDB with MySQL

XAMPP - Replace MariaDB with MySQL

Since XAMPP 5.5.30 and 5.6.14, XAMPP ships MariaDB instead of MySQL. MariaDB is not 100% compatible with MySQL and can be replaced with the "orginal" MySQL server.

Backup

  • Backup the old database into a sql dump file
  • Stop the MariaDB service
  • Rename the folder: c:\xampp\mysql to c:\xampp\mariadb
@scf37
scf37 / simulate_scanned_PDF.md
Created April 11, 2018 11:49
Simulate a scanned PDF with ImageMagick

Simulate a scanned PDF with ImageMagick

  1. Download and install Ghostscript and ImageMagick + Convert Module
  2. Execute the following command in the console (change the filename)
$ convert -density 200 INPUT.pdf -rotate 0.3 +noise Multiplicative -format pdf  -quality 85 -compress JPEG -colorspace gray OUTPUT.pdf

Description of the options

  • -density: set the input DPI to 200
  • -rotate: set Page rotation to 0.3 degrees
@WiliTest
WiliTest / some_google_doc_shortcuts_to_change_font_highlight.user.js
Last active March 26, 2024 10:34
some google doc shortcuts to change the font and highlights using a Userscript (works with ViolentMonkey)
// Help needed: I failed to send a value to the text resize and to apply it. Any idea ?
// to install this script: install the violentmonkey extension. Then click on "raw" on this github page.
// *perso note:
//to install or to send update:
// 1/ edit must be done on github (cf. the url in the tab settings).
// 2/ Edit/update the script (using the edit github button) + increase the version (or it will ask to reinstall in the next step)
// (don't need to increase the version if the change are just for myself: just reinstall it to keep the version)
// 3/ click on RAW (it will show the changes).