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
<?php | |
$payload = 'hello world'; | |
$stream = stream_socket_client("tcp://127.0.0.1:5555", $errno, $errstr); | |
if (!$stream) { | |
echo "{$errno}: {$errstr}\n"; | |
die(); | |
} | |
fwrite($stream, $payload); | |
stream_socket_shutdown($stream, STREAM_SHUT_WR); |
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
<?php | |
// 10 buckets and 10 types of color and 100 balls | |
// Each color will have at least one ball. | |
// Each bucket can hold up to ten balls (in result). | |
// Place all balls in buckets so that each bucket at most containst two variants of color. | |
// This function should return list of buckets. | |
// Each bucket is a list of color ids (integers). | |
$scale = 10; |
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
print "Type something: " | |
entered_chars = [] of Char | |
STDIN.raw do | |
loop do | |
char = STDIN.read_char | |
next if char.nil? |
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
# Ask for the user password | |
# Script only works if sudo caches the password for a few minutes | |
sudo true | |
# Install kernel extra's to enable docker aufs support | |
# sudo apt-get -y install linux-image-extra-$(uname -r) | |
# Add Docker PPA and install latest version | |
# sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9 | |
# sudo sh -c "echo deb https://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list" |
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
/** | |
* Dubiously created by Adrian Cooney | |
* http://adriancooney.github.io | |
*/ | |
(function(console) { | |
"use strict"; | |
/** | |
* Since the console.log doesn't respond to the `display` style, | |
* setting a width and height has no effect. In fact, the only styles | |
* I've found it responds to is font-size, background-image and color. |
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
docker rm $(docker ps -a -q) -f && docker rmi $(docker images -q) -f |
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
apt-get -y update && \ | |
apt-get -y install git-core zsh && \ | |
wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | zsh && \ | |
chsh -s `which zsh` && \ | |
echo 'PROMPT="[drone]$PROMPT"' >> ~/.zshrc && \ | |
echo 'alias rr=". ~/.zshrc"' >> ~/.zshrc && \ | |
echo 'alias d="docker"' >> ~/.zshrc && \ | |
echo 'alias dc="docker-compose"' >> ~/.zshrc && \ | |
echo 'rebooting... log back in 2 minutes' && \ | |
sudo shutdown -r 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
sudo apt-get update | |
sudo apt-get -y --no-install-recommends install curl apt-transport-https ca-certificates curl software-properties-common | |
curl -fsSL https://apt.dockerproject.org/gpg | sudo apt-key add - | |
apt-key fingerprint 58118E89F3A912897C070ADBF76221572C52609D | grep iud | |
sudo add-apt-repository "deb https://apt.dockerproject.org/repo/ ubuntu-$(lsb_release -cs) main" | |
sudo apt-get update | |
sudo apt-get -y install make docker-engine | |
sudo docker run hello-world |
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
0.0.0.0:80 | |
fastcgi / phpfmp:9000 php |
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
$ip = '123.12.123.123'; | |
$user = 'root'; | |
$pass = 'pass'; | |
$conn = ssh2_connect($ip); | |
ssh2_auth_password($conn, $user, $pass); | |
$stream = ssh2_exec($conn, 'whoami'); | |
stream_set_blocking($stream, true); |
NewerOlder