Skip to content

Instantly share code, notes, and snippets.

View iwnow's full-sized avatar
🎶
musicin

Vostroknutov Vitaliy iwnow

🎶
musicin
View GitHub Profile
@iwnow
iwnow / sol.md
Last active January 18, 2023 07:25
Fix for windows 10 VPN connection problems "parameter is incorrect" error

SOLUTION:

If you install the Windows 10 ps1 file (as noted in the installation instructions) and when you try to connect is says "parameter is incorrect" then so the following:

  1. Clear the Networking caches
    • Run windows cmd window (click windows start menu, type 'cmd', right click on 'Command Prompt' and select "Run as Administrator").

    • type command below

>netsh int ip reset

@iwnow
iwnow / zonejs-flags.ts
Created June 9, 2021 09:24 — forked from manekinekko/zonejs-flags.ts
Reduce overhead introduced by the Zone.js
// Reduce overhead introduced by the Zone.js:
// by Wassim Chegham (@manekinekko)
// Instructions:
// 1. Add this config in a different file, eg. zone-flags.ts
// 2. make sure to check that your app is not relying on an API before disabling it!!!
// 3. import ./zone-flags.ts in polyfills.ts
// Not needed for morst of Angular apps
(window as any).__Zone_disable_requestAnimationFrame = true;
@iwnow
iwnow / mat_hack_text.md
Last active February 3, 2021 11:34
Material icons text hack for blinking
<head>
	<style id="mat-icons-initial-hack">
		.mat-icon {
			opacity: 0;
		}
	</style>
</head>
@iwnow
iwnow / auto_accept_social_req.js
Last active January 17, 2021 12:16
Auto accept social network request script
async function addAllFriendReq(maxWaitSec, selector) {
let btns = Array.from(document.querySelectorAll(selector));
while(btns.length) {
await (async () => {
for (btn of btns) {
await (new Promise(res => setTimeout(res, Math.ceil(Math.random() * maxWaitSec * 1000))));
@iwnow
iwnow / public_enc_example.sh
Created May 17, 2019 21:27 — forked from thinkerbot/public_enc_example.sh
Public-key encryption example using OpenSSL
#!/bin/bash
#
# Public-Key Encryption and Decryption
# * http://www.openssl.org/
# * http://barelyenough.org/blog/2008/04/fun-with-public-keys/
#
# Mac OS X 10.6.4
# OpenSSL 0.9.8l 5 Nov 2009
# Generate keys
@iwnow
iwnow / qs.js
Created May 12, 2019 13:28
Get object search params from URL
Object.fromEntries((new URL(location.href)).searchParams)
@iwnow
iwnow / 0-throw-for-codes.ts
Created February 27, 2019 09:37 — forked from nilsmehlhorn/0-throw-for-codes.ts
RxJS operator for throwing semantic errors for certain HTTP status codes
import { Observable, throwError } from 'rxjs'
import { catchError } from 'rxjs/operators'
import { HttpErrorResponse } from '@angular/common/http'
export const throwForCodes = (codeErrors: Array<[number, Error]>) => {
const mappedCodeErrors = new Map(codeErrors)
return <T>(source: Observable<T>) =>
source.pipe(catchError(error => {
if (error instanceof HttpErrorResponse) {
return throwError(mappedCodeErrors.get(error.status) || error)
@iwnow
iwnow / composing-software.md
Created January 8, 2019 16:15 — forked from rosario/composing-software.md
Eric Elliott's Composing Software Series
@iwnow
iwnow / youtube-vimeo-matcher.js
Last active June 19, 2018 15:13
get youtube link from text and generate embed iframe
const regexMatch = (s, r) => s && s.split(' ')
.filter(w => w && r.test(w))
.map(w => w.match(r)[0]);
const s = `asasa as asas s https://www.youtube.com/watch?v=nGYwwvWiCi8
ds sd https://www.youtube.com/watch?v=wy2ef9vFqZg.. xcxcxc
asa
`,
onlyYoutubeRegexp = /http(?:s?):\/\/(?:www\.)?youtu(?:be\.com\/watch\?v=|\.be\/)([\w\-\_]*)(&(amp;)?‌​[\w\?‌​=]*)?/,
youtubeAndVimeoRegexp = /(http:\/\/|https:\/\/)(vimeo\.com|youtu\.be|www\.youtube\.com)\/([\w\/]+)([\?].*)?$/igm;
@iwnow
iwnow / spy-selector.js
Created May 12, 2018 22:16
typed selector method objects for spy instead of string, for example in jasmine test
type propSelector<T, K extends keyof T> = (obj: T) => T[K];
const spySelector: <T, K extends keyof T>(obj: T, selector: propSelector<T, K>) => string
= (obj, sel) => {
const prop = sel(obj);
let propName;
for (const p in obj) {
if (obj[p] === prop) {
propName = p;
break;