Skip to content

Instantly share code, notes, and snippets.

@Artem-Mamchych
Artem-Mamchych / lxml example
Created January 18, 2012 22:36
Пример использования lxml
# coding: utf8
xml = '''<?xml version="1.0" encoding="UTF-8"?>
<soft>
<os>
<item name="linux" dist="ubuntu">
This text about linux
</item>
<item name="mac os">
Apple company
@esskar
esskar / Foo.cpp
Created September 24, 2012 23:22
passing char*[] from c++ dll Struct to c#
#include <stdio.h>
#include <Windows.h>
struct Name
{
char FirstName[100];
char LastName[100];
char *Array[3];
};
@noromanba
noromanba / cd-dvd-burning.md
Last active January 25, 2023 06:17
How to burn ISO to CD/DVD and compare/verify on Linux

Burn ISO to CD/DVD and compare/verify on Linux

require wodim

scan available drives

scan optical devices

  • wodim -scanbus
  • wodim --devices

e.g.

@Lerg
Lerg / prepare_icons.sh
Last active April 11, 2024 19:25
Make all app icons with imagemagick, iOS and Android
#!/bin/sh
base=$1
convert "$base" -resize '29x29' -unsharp 1x4 "Icon-Small.png"
convert "$base" -resize '40x40' -unsharp 1x4 "Icon-Small-40.png"
convert "$base" -resize '50x50' -unsharp 1x4 "Icon-Small-50.png"
convert "$base" -resize '57x57' -unsharp 1x4 "Icon.png"
convert "$base" -resize '58x58' -unsharp 1x4 "[email protected]"
convert "$base" -resize '60x60' -unsharp 1x4 "Icon-60.png"
convert "$base" -resize '72x72' -unsharp 1x4 "Icon-72.png"
convert "$base" -resize '76x76' -unsharp 1x4 "Icon-76.png"
@brianhassel
brianhassel / PreventSleep.cs
Last active June 24, 2024 18:42
Prevent Computer Sleep in C#
internal static class NativeMethods {
public static void PreventSleep() {
SetThreadExecutionState(ExecutionState.EsContinuous | ExecutionState.EsSystemRequired);
}
public static void AllowSleep() {
SetThreadExecutionState(ExecutionState.EsContinuous);
}
@kitmenke
kitmenke / finderrors.ps1
Created August 1, 2016 02:45
Working in progress: powershell script to automatically fix DCOM errors which show up in the event log
# Get-EvengLog doesn't quite work I guess:
# https://stackoverflow.com/questions/31396903/get-eventlog-valid-message-missing-for-some-event-log-sources#
# Get-EventLog Application -EntryType Error -Source "DistributedCOM"
# The application-specific permission settings do not grant Local Activation permission for the COM Server application with CLSID
#$logs = Get-EventLog -LogName "System" -EntryType Error -Source "DCOM" -Newest 1 -Message "The application-specific permission settings do not grant Local Activation permission for the COM Server application with CLSID*"
# 2 is error
# 3 is warning
$EVT_MSG = "The application-specific permission settings do not grant Local Activation permission for the COM Server application with CLSID"
# Search for System event log ERROR entries starting with the specified EVT_MSG
$logEntry = Get-WinEvent -FilterHashTable @{LogName='System'; Level=2} | Where-Object { $_.Message -like "$EVT_MSG*" } | Select-Object -First 1
@giordanocardillo
giordanocardillo / README.MD
Last active November 10, 2024 17:35
Remove Office 2016 Product Key
  1. Open a command prompt as Administrator
  2. In the command prompt, type the following:
  • Office 2016 (32-bit) on a 32-bit version of Windows

    cscript "C:\Program Files\Microsoft Office\Office16\OSPP.VBS" /dstatus

  • Office 2016 (32-bit) on a 64-bit version of Windows

    cscript "C:\Program Files (x86)\Microsoft Office\Office16\OSPP.VBS" /dstatus

  • Office 2016 (64-bit) on a 64-bit version of Windows

@julianhille
julianhille / psExec.nsh
Last active April 28, 2022 20:30
NSIS Powershell execution with win64 support. 32bit NSIS starts a 64bit powershell script
;based on https://nsis.sourceforge.io/PowerShell_support but with x64 support
!include x64.nsh
!ifndef PSEXEC_INCLUDED
!define PSEXEC_INCLUDED
!macro PowerShellExecMacro PSCommand
InitPluginsDir
;Save command in a temp file
Push $R1
FileOpen $R1 $PLUGINSDIR\tempfile.ps1 w