Skip to content

Instantly share code, notes, and snippets.

View nazar-pc's full-sized avatar
🦀

Nazar Mokrynskyi nazar-pc

🦀
View GitHub Profile
@nazar-pc
nazar-pc / demo.rs
Created March 15, 2024 16:23
Windows unbuffered I/O serialization bug
//! ```cargo
//! [dependencies]
//! rand = "0.8.5"
//! rayon = "1.9.0"
//! windows = { version = "0.54.0", features = ["Wdk_Storage_FileSystem", "Win32_Storage_FileSystem", "Win32_System_IO", "Win32_Security", "Win32_System_Threading"] }
//! ```
use rand::prelude::*;
use rayon::prelude::*;
use std::fs::File;
2024-03-12 06:48:10,735 10628 [INFO ] - Chocolatey v2.2.2
2024-03-12 06:48:10,735 10628 [DEBUG] - Chocolatey is running on Windows v 10.0.22631.0
2024-03-12 06:48:10,735 10628 [DEBUG] - Attempting to delete file "C:/ProgramData/chocolatey/choco.exe.old".
2024-03-12 06:48:10,735 10628 [DEBUG] - Attempting to delete file "C:\ProgramData\chocolatey\choco.exe.old".
2024-03-12 06:48:10,751 10628 [DEBUG] - Command line: "C:\ProgramData\chocolatey\choco.exe" install clang cmake make
2024-03-12 06:48:10,751 10628 [DEBUG] - Received arguments: install clang cmake make
2024-03-12 06:48:10,766 10628 [DEBUG] - RemovePendingPackagesTask is now ready and waiting for PreRunMessage.
2024-03-12 06:48:10,782 10628 [DEBUG] - Sending message 'PreRunMessage' out if there are subscribers...
2024-03-12 06:48:10,782 10628 [DEBUG] - [Pending] Removing all pending packages that should not be considered installed...
2024-03-12 06:48:10,813 10628 [DEBUG] - Performing validation checks.
import {MediaKind, RtpCodecParameters, RtpParameters} from "mediasoup/lib/RtpParameters";
import {DtlsFingerprint, DtlsParameters, IceCandidate, IceParameters} from "mediasoup/lib/WebRtcTransport";
export interface ISdpConsumer {
id: string;
kind: MediaKind;
rtpParameters: RtpParameters;
removed: boolean;
}
Index: Scan/Rapoo_E9070/scancode_map.kll
<+>UTF-8
===================================================================
--- Scan/Rapoo_E9070/scancode_map.kll (date 1494331172000)
+++ Scan/Rapoo_E9070/scancode_map.kll (date 1530481749000)
@@ -43,7 +43,7 @@
S0x7A : U"-";
S0x78 : U"=";
S0x1D : U"Backspace";
-S0x46 : U"Keypad Decimal";
@nazar-pc
nazar-pc / p448_bias-simd.c
Created August 15, 2017 13:38
SIMD version of p448_bias
void
p448_bias (
p448_t *a,
int amt
) {
uint32_t co1 = ((1ull<<28)-1)*amt, co2 = co1-amt;
uint32x4_t lo = {co1,co1,co1,co1}, hi = {co2,co1,co1,co1};
uint32x4_t *aa = (uint32x4_t*) a;
aa[0] += lo;
aa[1] += lo;
@nazar-pc
nazar-pc / update
Created August 3, 2017 22:45
Update chromium Nightly on Linux
#!/bin/bash
cd /home/nazar-pc/chromium
wget -O chromium.zip https://download-chromium.appspot.com/dl/Linux_x64?type=snapshots
shopt -s extglob
rm -rf !(chromium.zip|update)
shopt -u extglob
unzip chromium.zip
mv chrome-linux/* .
<?php
# Creates tree from flat key-value translations
# Can reduce JSON size by 10%, but adds a lot of complexity
# Maybe, it doesn't worth it:(
function make_tree ($input) {
$keys = array_keys($input);
$result = [];
// Step by step create tree by moving one character deeper
while (count($keys)) {
$key = $keys[0];
@nazar-pc
nazar-pc / darkenergy-uikit.less
Created August 31, 2015 16:39
DarkEnergy UIkit theme
/* theme: Default */
//
// General
//
@global-background: #161616;
@global-border: #2e2e2e;
@utility-container-max-width: auto;
@nazar-pc
nazar-pc / tenebris-uikit.less
Created August 30, 2015 09:39
Tenebris UIkit theme
/* theme: Almost Flat */
//
// General
//
@global-background: #131313;
@global-border: #252525;
@nazar-pc
nazar-pc / backup-docker-daily
Created July 9, 2015 21:42
Docker containers backup
#!/usr/bin/php
<?php
$local_backup_dir = '/backup-local';
$target_backup_dir = '/backup';
$backup_prefix = '';
$backup_suffix = '-'.date('l');
/**
* We'll make backups to local directory first and then move to target
*/
chdir($local_backup_dir);