This file contains hidden or 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
[ | |
{ | |
"name": "Alabama", | |
"abbreviation": "AL" | |
}, | |
{ | |
"name": "Alaska", | |
"abbreviation": "AK" | |
}, | |
{ |
This file contains hidden or 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
// import node-fetch module | |
const fetch = require("node-fetch"); | |
// return user-agent from request | |
const userAgent = fetch("https://httpbin.org/user-agent") | |
.then((response) => response.json()) | |
.then((response) => response); | |
// return origin IP from request | |
const originIP = fetch("https://httpbin.org/ip") |
This file contains hidden or 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
import asyncio | |
import aiohttp | |
my_urls = [ | |
'https://www.google.com/', | |
'https://www.youtube.com/', | |
'https://www.facebook.com/', | |
'https://www.wikipedia.org/', | |
'https://www.yahoo.com/', | |
'https://www.reddit.com/', |
This file contains hidden or 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
# tested with HAProxy 2.0 LTS on Debian 9 | |
global | |
stats socket /tmp/haproxy_admin.sock mode 660 level admin expose-fd listeners | |
stats timeout 30s | |
user haproxy | |
group haproxy | |
defaults | |
mode http | |
maxconn 500 |
This file contains hidden or 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 | |
$array = array( | |
'fruit1' => 'apple', | |
'fruit2' => 'orange', | |
'fruit3' => 'grape', | |
'fruit4' => 'mango', | |
'fruit5' => 'peach'); | |
echo $array['fruit3']; | |
echo "\n"; |
This file contains hidden or 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 | |
$mem = new Memcached(); | |
$mem->addServer("127.0.0.1", 11211); | |
$result = $mem->get("username"); | |
if ($result) { | |
echo $result; | |
} else { | |
echo "No matching key found. I'll add that now!\n"; |
This file contains hidden or 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
log_format json_combined escape=json | |
'{' | |
'"time_local":"$time_local", ' | |
'"remote_addr":"$remote_addr", ' | |
'"client_addr":"$proxy_add_x_forwarded_for", ' | |
'"request_type": "$request_method", ' | |
'"request":"$request", ' | |
'"request_uri": "$uri", ' | |
'"query_string": "$query_string", ' | |
'"status": "$status", ' |
This file contains hidden or 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
{ | |
"_all": { | |
"primaries": { | |
"completion": { | |
"size_in_bytes": 0 | |
}, | |
"docs": { | |
"count": 1989994, | |
"deleted": 0 | |
}, |
This file contains hidden or 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 python | |
import paramiko | |
SSH_HOST='host.example.com' | |
SSH_USER='admin_user' | |
SSH_KEY='/home/user/.ssh/id_rsa' | |
def do_ssh_command(command): | |
try: | |
with paramiko.SSHClient() as client: |
NewerOlder