This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# WebSocket shell, start & browse to http://<Host>:6655/ | |
# Requires bash 4.x, openssl. | |
# Author: [email protected] (which isn't me, apk) | |
coproc d { nc -l -p 6656 -q 0; } | |
nc -l -p 6655 -q 1 > /dev/null <<-ENDOFPAGE | |
HTTP/1.1 200 OK | |
<html><head><script language="javascript"> | |
var url = location.hostname + ':' + (parseInt(location.port) + 1); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- 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%' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Installing Arch: | |
sudo vim /etc/pacman.conf | |
Update packages list: sudo pacman -Syy | |
run sudo pacman -Syu before installing any software (to update the repositories first) | |
* Timing issue: | |
- Change hardware clock to use UTC time: | |
sudo timedatectl set-local-rtc 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# | |
# cowerupdate | |
# | |
# Script to update AUR packages installed through cower. | |
# | |
# Copyright 2013-2015, iceTwy | |
# Licensed under the WTFPLv2 (http://www.wtfpl.net/about/) | |
cower_updatesearch_cmd="cower -u" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def debounced_wrap(func): | |
@functools.wraps(func) | |
def wrapper(*args, **kwargs): | |
key = kwargs.pop("key") # it's required | |
call_count = kwargs.pop("call_count", 1) | |
count = cache.get(key, 1) | |
if count > call_count: | |
# someone called the function again before the this was executed | |
return None | |
# I'm the last call |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
// The aim of this example is to illustrate backpressure using golang channels and go routines. | |
// | |
// This is the basis for a simple data processing service which could either be reading from | |
// some internal queue or a socket of some sort. | |
import ( | |
"fmt" | |
"math/rand" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo ========== | |
echo Check root | |
echo ========== | |
if [[ $UID == 0 ]]; then | |
echo "Please run this script WITHOUT sudo:" | |
echo "$0 $*" | |
exit 1 | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### KERNEL TUNING ### | |
# Increase size of file handles and inode cache | |
fs.file-max = 2097152 | |
# Do less swapping | |
vm.swappiness = 10 | |
vm.dirty_ratio = 60 | |
vm.dirty_background_ratio = 2 |