Skip to content

Instantly share code, notes, and snippets.

View dzmitry-lahoda's full-sized avatar

dzmitry-lahoda dzmitry-lahoda

View GitHub Profile
@anderiv
anderiv / Get-SvrInfo.ps1
Created March 10, 2014 16:43
Scan network for Windows Servers and Printers (original source: http://serverfault.com/a/580614/20815)
#scan network for Windows Servers and Printers
function get-serversin{
<#
.Description
Retrives hosts running Windows Server operating systems in a specified network range
.Parameter
Network start address. Normally starts at .0 of the network range.
.Example
Get-ServersIn -Network 192.168.1.0
Scans from 192.168.1.0 to 192.168.1.254
@nicktoumpelis
nicktoumpelis / repo-rinse.sh
Created April 23, 2014 13:00
Cleans and resets a git repo and its submodules
git clean -xfd
git submodule foreach --recursive git clean -xfd
git reset --hard
git submodule foreach --recursive git reset --hard
git submodule update --init --recursive
@Sennahoi
Sennahoi / extract.js
Created August 5, 2014 14:16
Extract bookmarks from a netscape bookmark file with node.js
var cheerio = require("cheerio"),
fs = require("fs");
fs.readFile('bookmarks.html', "utf-8", function read(err, data) {
if (err) {
throw err;
}
var $ = cheerio.load(data);
$("a").each(function(index, a) {
@bennor
bennor / ProxyRestService.cs
Last active October 24, 2023 15:31
A polyfill for Refit 2.0+ in scripting environments (e.g. LINQPad). Warning: This won't work on all platforms Refit 2.0+ supports (e.g. iOS, maybe WinRT?).
using System.Net.Http;
using Castle.DynamicProxy; // From Castle.Core
using Refit;
public class ProxyRestService
{
static readonly ProxyGenerator Generator = new ProxyGenerator();
public static T For<T>(HttpClient client)
where T : class
@kekekeks
kekekeks / ru_en_analyzer
Last active April 12, 2023 15:16
russian + english analyzer for elasticsearch русский + английский
{
"settings": {
"analysis": {
"filter": {
"english_stop": {
"type": "stop",
"stopwords": "_english_"
},
"english_stemmer": {
"type": "stemmer",
// Copyright 2015 Mårten Rånge
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
@gafferongames
gafferongames / delta_compression.cpp
Last active April 28, 2025 22:48
Delta Compression
/*
Delta Compression by Glenn Fiedler.
This source code is placed in the public domain.
http://gafferongames.com/2015/03/14/the-networked-physics-data-compression-challenge/
*/
#include <stdint.h>
#include <stdio.h>
#include <assert.h>
#include <string.h>
@protrolium
protrolium / ffmpeg.md
Last active June 1, 2025 19:07
ffmpeg guide

ffmpeg

Converting Audio into Different Formats / Sample Rates

Minimal example: transcode from MP3 to WMA:
ffmpeg -i input.mp3 output.wma

You can get the list of supported formats with:
ffmpeg -formats

You can get the list of installed codecs with:

@mfuerstenau
mfuerstenau / zigzag-encoding.README
Last active May 26, 2025 21:43
ZigZag encoding/decoding explained
ZigZag-Encoding
---------------
Maps negative values to positive values while going back and
forth (0 = 0, -1 = 1, 1 = 2, -2 = 3, 2 = 4, -3 = 5, 3 = 6 ...)
(i >> bitlength-1) ^ (i << 1)
with "i" being the number to be encoded, "^" being
XOR-operation and ">>" would be arithemtic shifting-operation
@NicolasT
NicolasT / active.hs
Created September 8, 2015 22:54
Haskell representation of F#-style Active Patterns
-- https://www.reddit.com/r/haskell/comments/3huexy/what_are_haskellers_critiques_of_f_and_ocaml/cuisrmj
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ViewPatterns #-}
module Main where
import Text.Read (readMaybe)
pattern Even <- ((`mod` 2) -> 0)