Skip to content

Instantly share code, notes, and snippets.

View mika76's full-sized avatar
🤖
Coding...

Mladen Mihajlović mika76

🤖
Coding...
  • Serbia
  • 04:48 (UTC +02:00)
View GitHub Profile
@mika76
mika76 / IniSerializer.cs
Last active January 16, 2024 20:45
INI Serializer for .NET Core in C# - Pretty basic with some validations and Serialize and Deserialize methods. There are lot's of variations for ini files though so it will probably not support every scenario. Feel free to adapt to your use-case.
using System;
using System.Linq;
using System.Collections.Generic;
using System.IO;
using System.Text;
namespace tools
{
/// <summary>
/// Serializer class for ini files.
@mika76
mika76 / MuuriGrid.vue
Created August 18, 2020 08:45 — forked from sploders101/MuuriGrid.vue
Array-based muuri grid
<template>
<div
ref="muuriel"
class="muuri"
>
<div
class="muuri-item"
v-for="field in value"
:muurikey="field[muurikey]"
@mika76
mika76 / pliim-turnOff.scpt
Created June 12, 2020 10:15 — forked from zehfernandes/pliim-turnOff.scpt
One click and be ready to go up on stage and shine! - https://zehfernandes.github.io/pliim/
# Turn on Notifications
do shell script "defaults -currentHost write com.apple.notificationcenterui doNotDisturb -bool FALSE; defaults -currentHost delete com.apple.notificationcenterui doNotDisturbDate; osascript -e 'quit application \"NotificationCenter\" ' && killall usernoted" -- this set 'Do not disturb' to false in the pref
# Show Desktop
do shell script "defaults write com.apple.finder CreateDesktop -bool true; killall Finder"
# Show all windows
tell application "System Events"
set visible of (every process) to true
end tell
<!DOCTYPE html>
<html lang="en">
<head>
<link rel=icon href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text
y='.9em' font-size='90'>😍</text></svg>">
</head>
<body>
</body>
</html>
@mika76
mika76 / int2ip.js
Created March 22, 2020 09:10 — forked from jppommet/int2ip.js
javascript conversion from ip address to long integer and vice versa
function int2ip (ipInt) {
return ( (ipInt>>>24) +'.' + (ipInt>>16 & 255) +'.' + (ipInt>>8 & 255) +'.' + (ipInt & 255) );
}
@mika76
mika76 / copyfiles.ps1
Last active January 24, 2020 12:23
TFS powershell copy items to unc with credentials
# Create credential from user pass strings
$User = "192.168.0.10\administrator"
$PWord = ConvertTo-SecureString -String "pass123" -AsPlainText -Force
$Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $User, $PWord
# Create mapped drive Y: with the UNC path
New-PSDrive -Name Y -PSProvider filesystem -Root "\\192.168.0.10\sharedfolder" -Credential $Credential
# Copy files to Y: drive
@mika76
mika76 / QueryVisitor.cs
Last active January 23, 2020 14:50
QueryVisitor for rewriting lucene.net query (add wildcards) - check https://stackoverflow.com/a/5748786/11421 - originally from Random Ramblings blog (https://web.archive.org/web/20130207075825/http://devhost.se/blog/post/2011/04/21/A-QueryVisitor-for-Lucene.aspx)
using Lucene.Net.Index;
using Lucene.Net.Search;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
namespace Lucene.Helpers
{
// https://stackoverflow.com/a/5748786/11421
select top 10 schema_name(tab.schema_id) + '.' + tab.name as [table],
cast(sum(spc.used_pages * 8)/1024.00 as numeric(36, 2)) as used_mb,
cast(sum(spc.total_pages * 8)/1024.00 as numeric(36, 2)) as allocated_mb
from sys.tables tab
join sys.indexes ind
on tab.object_id = ind.object_id
join sys.partitions part
on ind.object_id = part.object_id and ind.index_id = part.index_id
join sys.allocation_units spc
on part.partition_id = spc.container_id
@mika76
mika76 / 1-setup.md
Created November 8, 2019 10:33 — forked from troyfontaine/1-setup.md
Signing your Git Commits using GPG on MacOS Sierra/High Sierra

Methods of Signing with GPG

There are now two ways to approach this:

  1. Using gpg and generating keys
  2. Using Kryptonite by krypt.co

This Gist explains how to do this using gpg in a step-by-step fashion. Kryptonite is actually wickedly easy to use-but you will still need to follow the instructions

For using a GUI-based GIT tool such as Tower or Github Desktop, follow the steps here for signing with either GPG or Krypt.co.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
using System.Collections.Specialized;
namespace AUtility
{
// From http://stackoverflow.com/questions/1770297/how-does-mef-determine-the-order-of-its-imports