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
import os | |
import requests | |
from bs4 import BeautifulSoup | |
from urllib.parse import urljoin | |
from collections import deque | |
def should_skip_link(href): | |
# Define all conditions to skip a link | |
return href in {'../', '/', '?C=N;O=D', '?C=M;O=A', '?C=S;O=A', '?C=D;O=A', '', '#'} or href.startswith('..') or href.startswith('/') |
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
import { NextResponse } from 'next/server' | |
import type { NextRequest } from 'next/server' | |
export function middleware(request: NextRequest) { | |
const url = request.nextUrl.clone() | |
// Redirect to www with port only in production | |
if ( | |
process.env.NODE_ENV === 'production' && | |
!url.hostname.startsWith('www.') |
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 run --name=mk-mysql -p3306:3306 -e MYSQL_ROOT_PASSWORD=secret-pw -d mysql:latest | |
docker exec -it mk-mysql bash | |
mysql -u root -p | |
secret-pw | |
CREATE DATABASE MYSQLTEST; | |
ALTER USER 'root' IDENTIFIED WITH mysql_native_password BY 'secret-pw'; |
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
const amqp = require('amqplib'); | |
class AMQPTalker { | |
private static connection: any; | |
private static channel: any; | |
// create amqp connection | |
private static async getConnection(): Promise<Record<any, any>> { | |
if(AMQPTalker.connection == undefined || AMQPTalker.channel == undefined) { |
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 install mysql-server mysql-client | |
apt-get -y install apache2 php7.0 libapache2-mod-php7.0 | |
apt-get -y install php7.0-mysql php7.0-curl php7.0-gd php7.0-intl php-pear php-imagick php7.0-imap php-memcache php7.0-pspell php7.0-recode php7.0-sqlite3 php7.0-tidy php7.0-xmlrpc php7.0-xsl php7.0-mbstring php-gettext | |
apt-get -y install php7.0-opcache php-apcu | |
apt-get -y install phpmyadmin | |
adduser $USER www-data | |
chown -R www-data.www-data /var/www | |
chmod -R 770 /var/www | |
systemctl restart apache2 | |
apt-get -y install composer git |
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 | |
apt-get update | |
apt -y dist-upgrade | |
apt install -y sudo vim vim-nox lynx zip binutils wget openssl ssl-cert ssh | |
apt install -y bridge-utils git python-pip | |
pip install --upgrade pip | |
pip install -U os-testr |
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
request: async function(method, url, headers) { | |
return new Promise((resolve, reject) => { | |
request({ | |
uri: url, | |
method: method, | |
timeout: 10000, | |
followRedirect: true, | |
maxRedirects: 10, | |
headers: headers, | |
}, function(error, response, body) { |
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
/************************************************** | |
* TO USE ON YOUR SUGGESTIONS https://twitter.com/who_to_follow/suggestions | |
**************************************************/ | |
setInterval(function() { | |
var t = $(".content-main").find(".follow-button button.follow-text:visible"); | |
if(!t[0]){ | |
window.scrollTo(0,$(document).height()); | |
} else { | |
t.trigger("click"); | |
} |
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/sh | |
#IPv4 | |
iptables -F | |
iptables -X | |
iptables -P INPUT ACCEPT | |
iptables -P OUTPUT ACCEPT | |
iptables -P FORWARD ACCEPT |
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/sh | |
# Stop containers | |
docker stop $(docker ps -a -q) | |
# remove containers | |
# docker rm $(docker ps -a -q) | |
# remove containers and volumes | |
docker rm -v $(docker ps -a -q) |
NewerOlder