Skip to content

Instantly share code, notes, and snippets.

View avevlad's full-sized avatar
🚲

Vlad Derzhavin avevlad

🚲
View GitHub Profile
@mbostock
mbostock / .block
Last active November 22, 2022 23:32
Line Transition
license: gpl-3.0
@firedfox
firedfox / gist:2037945
Created March 14, 2012 17:09
find google ads with phantomjs
var page = require('webpage').create();
page.settings.loadImages = false;
page.onConsoleMessage = function(msg) { console.log(msg); };
page.onLoadFinished = function() {
page.evaluate(function() {
var getFrames = function(doc) {
var frames = doc.querySelectorAll('iframe');
for (var i = frames.length - 1; i >= 0; i--) {
var fdoc = frames[i].contentWindow.document;
@paulmillr
paulmillr / active.md
Last active April 23, 2024 17:32
Most active GitHub users (by contributions). http://twitter.com/paulmillr

Most active GitHub users (git.io/top)

The count of contributions (summary of Pull Requests, opened issues and commits) to public repos at GitHub.com from Wed, 21 Sep 2022 till Thu, 21 Sep 2023.

Only first 1000 GitHub users according to the count of followers are taken. This is because of limitations of GitHub search. Sorting algo in pseudocode:

githubUsers
 .filter(user => user.followers > 1000)
@rgreenjr
rgreenjr / postgres_queries_and_commands.sql
Last active April 23, 2024 19:14
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@hintjens
hintjens / dechat.c
Created April 22, 2013 11:05
Decentralized chat app in C (40 lines)
#include <czmq.h>
static void
listener_thread (void *args, zctx_t *ctx, void *pipe)
{
void *listener = zsocket_new (ctx, ZMQ_SUB);
zsocket_set_subscribe (listener, "");
int address;
for (address = 1; address < 255; address++)
anonymous
anonymous / main.php
Created May 21, 2013 02:50
<?
$p = "Съешь ещё этих мягких [block=100000] французских булок.";
$p = preg_replace_callback('/\\[([a-zA-Z]+)=([0-9]+)\\]/si', 'preg_handler', $p);
function preg_handler($matches)
{
return $matches[1]($matches[2]);
}
echo $p;
@yyx990803
yyx990803 / nl.sh
Last active March 5, 2024 01:24
npm list only top level modules.
alias ng="npm list -g --depth=0 2>/dev/null"
alias nl="npm list --depth=0 2>/dev/null"
@jedi4ever
jedi4ever / nodejs-cluster-zero-downtime.md
Last active February 11, 2024 13:45
nodejs clustering, zero downtime deployment solutions

Clustering: The basics

The trick? pass the file descriptor from a parent process and have the server.listen reuse that descriptor. So multiprocess in their own memory space (but with ENV shared usually)

It does not balance, it leaves it to the kernel.

In the last nodejs > 0.8 there is a cluster module (functional although marked experimental)

@stuartsierra
stuartsierra / fresh-chrome.sh
Last active October 13, 2020 16:07
Launch new instances of Google Chrome on OS X with isolated cache, cookies, and user config
#!/usr/bin/env bash
# fresh-chrome
#
# Use this script on OS X to launch a new instance of Google Chrome
# with its own empty cache, cookies, and user configuration.
#
# The first time you run this script, it will launch a new Google
# Chrome instance with a permanent user-data directory, which you can
# customize below. Perform any initial setup you want to keep on every
@0xBADC0FFEE
0xBADC0FFEE / scp
Created September 3, 2013 09:57
Постоянно забываю как копировать по ssh
scp -r -C root@re.mo.te.host:/path/to/directory /local/path
# копировать с удаленного хоста к себе
# -r с вложенными директориями
# -С с компрессией