Skip to content

Instantly share code, notes, and snippets.

View vvolodin's full-sized avatar

Volodymyr Volodin vvolodin

View GitHub Profile
Spy Game, 2001
The Good Shepherd (2006)
The Ghost Writer, 2010
The Spy Who Came in from the Cold (1965)
Ronin (1998)
Tinker Tailor Soldier Spy (2011)
The American (2010)
@vvolodin
vvolodin / gist:86642fb0307cff8f7d8c
Created August 8, 2014 08:15
Quick proxy server with request hostname rewrite
var http = require('http'),
httpProxy = require('http-proxy');
var proxy = httpProxy.createProxy();
proxy.on('proxyRes', function (res) {
//console.log('RAW Response from the target', JSON.stringify(res.headers, true, 2));
});
proxy.on('proxyReq', function (req) {
console.log('BEFORE Request from the WEB', JSON.stringify(req._headers, true, 2));
req._headers.host = "localhost:44320";
@vvolodin
vvolodin / gist:7b081d5684707ea9da21
Created October 21, 2014 14:23
GLOBAL SUPER EXTRA RANK
1. www.google.com - GLOBAL RANK 1
2. vlad.devmiles.com - GLOBAL RANK 2
3. blogger - GLOBAL RANK -666666.66
4. WORDPRESS - GLOBAL RANK - 3
patchValue(form:FormBuilder, object){
var iterate = (mForm:FormBuilder, mObject)=> {
for (var key in mObject) {
if (Array.isArray(mObject[key])) {
if(!mForm[key]){
if(Array.isArray(mForm.value)){
mForm.push(new FormArray([]))
} else {
mForm.addControl(key, new FormArray([]));
}
@vvolodin
vvolodin / delete-evicted-pods-all-namespaces.sh
Created March 26, 2019 17:10 — forked from psxvoid/delete-evicted-pods-all-namespaces.sh
Delete evicted pods from all namespaces (also ImagePullBackOff and ErrImagePull)
#!/bin/sh
# based on https://gist.github.com/ipedrazas/9c622404fb41f2343a0db85b3821275d
# delete all evicted pods from all namespaces
kubectl get pods --all-namespaces | grep Evicted | awk '{print $2 " --namespace=" $1}' | xargs kubectl delete pod
# delete all containers in ImagePullBackOff state from all namespaces
kubectl get pods --all-namespaces | grep 'ImagePullBackOff' | awk '{print $2 " --namespace=" $1}' | xargs kubectl delete pod
# delete all containers in ImagePullBackOff or ErrImagePull or Evicted state from all namespaces
@vvolodin
vvolodin / animation-bad-1.ts
Last active August 5, 2022 10:08
article-1-snippet-1
trigger('fadeIn', [
state('in', style({ opacity: 1, display: 'block' })),
state('out', style({ opacity: 0, display: 'none' })),
transition('in => out', [
sequence([
style({ opacity: 1 }),
animate('0.15s ease-in-out', style({ opacity: 0 })),
style({ opacity: 0, display: 'none' })
])
]),
@vvolodin
vvolodin / animation-good.ts
Created August 5, 2022 13:05
Angular crossfade good
trigger('fadeIn', [
state('in', style({ opacity: 1, display: 'block' })),
state('out', style({ opacity: 0, display: 'none' })),
transition('in => out', [
sequence([
style({ opacity: 1 }),
animate('0.15s ease-in-out', style({ opacity: 0 })),
style({ opacity: 0, display: 'none' })
])
]),
string longMessage = """"
This is a long message.
It has several lines.
Some are indented
more than others.
Some are """heavily""" quoted and it's still fine.
Some should start at the first column.
Some have "quoted text" in them.
"""";
var location = $$"""
You are at {{{Longitude}}, {{Latitude}}}
""";
int[] first = { 1 };
int[] second = { 1, 2, 3, 4 };
int[] third = { 1, 1, 0, 3, 5 };
Console.WriteLine(first is [1, 2]); // false, length
Console.WriteLine(second is [1, .., 4]); //true
Console.WriteLine(third is [_, >1, ..]); //false, 1 is not > 1