Skip to content

Instantly share code, notes, and snippets.

Avatar

Piotr Paczkowski (trzeci.eu) trzecieu

View GitHub Profile
@trzecieu
trzecieu / test.cpp
Created Jan 29, 2019
nullptr vtable vs2017
View test.cpp
#include <functional>
struct Base {
virtual void f() const = 0;
};
int main() {
struct : public Base {
void f() const override {}
} a, b; // vTables of 'a' and 'b' contain nulls
// not crucial for problem, helps to emphasize problem
View code-url-handler.desktop
#/usr/share/applications/code-url-handler.desktop
[Desktop Entry]
Name=Visual Studio Code - URL Handler
Comment=Code Editing. Redefined.
GenericName=Text Editor
Exec=/usr/share/code/code --open-url %U
Icon=code
Type=Application
NoDisplay=true
StartupNotify=true
@trzecieu
trzecieu / install_wsl_creators_update.bat
Last active Jun 29, 2019
Automates process of installation and configuration of WSL
View install_wsl_creators_update.bat
@echo off
echo - This scripts automates process of installing Windows Subsystem for Linux (WSL)
REM Due some limitations, this script has to be can't be executed under PowerShell
Get-ChildItem >nul 2>&1
if %errorLevel% == 0 (
echo # Swich to CMD
cmd /c start "" %0
exit 0
)
@trzecieu
trzecieu / reset_all_windows10_store_apps.ps1
Last active Mar 13, 2017
reset_all_windows10_store_apps
View reset_all_windows10_store_apps.ps1
# For when for some reason these apps are failing like:
# - unable to open Photos
# - Cannot type right after pressing 'Win' button
# source: https://answers.microsoft.com/en-us/windows/forum/windows_10-win_cortana/cant-type-in-windows-10-search-bar/7dce8411-8671-4d3e-90d1-b9bdc0aa4734
Get-AppXPackage -AllUsers |Where-Object {$_.InstallLocation -like "*SystemApps*"} | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"}
View install_wsl.bat
@echo off
echo - This scripts automates process of installing Windows Subsystem for Linux (WSL)
REM Due some limitations, this script has to be can't be executed under PowerShell
Get-ChildItem >nul 2>&1
if %errorLevel% == 0 (
echo # Swich to CMD
cmd /c start "" %0
exit 0
)
View install_pulseaudio.bat
@ECHO OFF
SET "LINUXTMP=$(echo '%TMP:\=\\%' | sed -e 's|\\|/|g' -e 's|^\([A-Za-z]\)\:/\(.*\)|/mnt/\L\1\E/\2|')"
echo LINUXTMP = "%LINUXTMP%"
ECHO --- PulseAudio...
C:\Windows\System32\bash.exe -xc "wget -cO '%LINUXTMP%/pulseaudio.zip' 'http://bosmans.ch/pulseaudio/pulseaudio-1.1.zip'"
ECHO --- Extracting PulseAudio
md "%TMP%\pulseaudio"
View .conemu.cmd
@rem File is based on CmdInit.cmd from ConEmu folder
@rem To make it work, it's required to change tasks in XML
@echo off
:: I would like to achieve efect like:
:: User@PC PATH
:: Where @ becomes # if admin
rem Simple "ver" prints empty line before Windows version
View CmdInit.cmd
@echo off
set CPath=$E[92m
set CPathAdmin=$E[93m
set CInd=$E[90m
set CReset=$E[90m
rem Simple "ver" prints empty line before Windows version
rem Use this construction to print just a version info
cmd /d /c ver | "%windir%\system32\find.exe" "Windows"
@trzecieu
trzecieu / fetch
Created Oct 18, 2015
Fetch devopreaction.tumbrl.com
View fetch
#!/usr/bin/env python
api_key = "" #API KEY
blog = "devopsreactions.tumblr.com"
url_info = "https://api.tumblr.com/v2/blog/{blog}/info?api_key={api_key}"
url_posts = "https://api.tumblr.com/v2/blog/{blog}/posts/text?api_key={api_key}&offset={offset}"
def get_info():
return url_info.format(api_key=api_key, blog=blog)
View gist:73effcbd74db61e97a00
@echo off
chdir D:\APP\CYGWIN_SETUP
IF NOT EXIST CYGWIN_SETUP (
mkdir CYGWIN_SETUP
)
chdir D:\APP\CYGWIN_SETUP
wget http://cygwin.com/setup-x86.exe -O setup-x86.exe
setup-x86 --arch x86 --quiet-mode --no-admin --no-startmenu --no-desktop --no-shortcuts --root C:\cygwin --site http://cygwin.mirror.constant.com --packages libuuid1,libuuid-devel,make,gettext-devel,libgettextpo-devel,libgettextpo0,libintl-devel,libintl3,libintl8,gettext