Skip to content

Instantly share code, notes, and snippets.

@infinityhacks
infinityhacks / eslintrc
Created November 23, 2022 16:26 — forked from gndx/eslintrc
{
"env": {
"browser": true,
"es6": true,
"node": true
},
"extends": ["airbnb"],
"globals": {
"document": false,
"escape": false,
#!/bin/bash
set -o errexit
clear
# Set versions. Check http://openresty.org for latest version and bundled version of nginx.
OPENRESTY_VERSION=1.9.3.1
NGINX_VERSION=1.9.3
OPENSSL_VERSION=1.0.2d
NPS_VERSION=1.9.32.10
@infinityhacks
infinityhacks / python_athena.py
Created June 1, 2021 07:20 — forked from ankit-crossml/python_athena.py
Medium Blog - Athena S3 - python athena example
import boto3
import time
import re
client = boto3.client('athena')
# run athen query
response = client.start_query_execution(
QueryString=athena_query,
QueryExecutionContext={'Database': ATHENA_DATABASE_NAME},
@infinityhacks
infinityhacks / rdate.md
Created March 4, 2021 04:56 — forked from vqiu/rdate.md
使用 rdate 替代ntp 功能

总有那么些蛋疼的机房,为了所谓的这安全,将NTP 服务器一刀切了。这时候时间同步就是一个问题,不过我们还可以使用 rdate 来解决。

yum -y install rdate
rdate -s time.nist.gov

cat > /etc/cron.daily/rdate << "EOF"
#!/bin/sh
rdate -s time.nist.gov
curl -o /dev/null -w "Connect: %{time_connect} TTFB: %{time_starttransfer} Total time: %{time_total} \n" http://inserturl.here
@infinityhacks
infinityhacks / nginx-handrolled-lua-spdy-pagespeed
Created October 16, 2018 14:58 — forked from shrikeh/nginx-handrolled-lua-spdy-pagespeed
Set up nginx with Lua, Pagespeed, et al.
# Ubuntu instructions
# Get the pre-reqs for this (Ubuntu)
sudo apt-get install git-core build-essential zlib1g-dev libpcre3 libpcre3-dev redis-server libssl-dev libgeoip-dev libgoogle-perftools-dev geoip-database lua5.1 liblua5.1-0 liblua5.1-0-dev lua-iconv-dev libghc-iconv-dev luarocks libpcre3-dev libghc-zlib-bindings-dev
# For Centos:
sudo yum install wget
wget http://ftp.riken.jp/Linux/fedora/epel/RPM-GPG-KEY-EPEL-6
wget http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
@infinityhacks
infinityhacks / ttfb.sh
Created September 29, 2018 06:56 — forked from sandeepraju/ttfb.sh
curl command to check the time to first byte
#!/bin/bash
# file: ttfb.sh
# curl command to check the time to first byte
# ** usage **
# 1. ./ttfb.sh "https://google.com"
# 2. seq 10 | xargs -Iz ./ttfb.sh "https://google.com"
curl -o /dev/null \
-H 'Cache-Control: no-cache' \
-s \
@infinityhacks
infinityhacks / Dockerfile
Created September 16, 2018 08:58 — forked from Rudis1261/Dockerfile
Rails Docker Setup
FROM ruby:2.3.1
RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs
RUN apt-get install -y imagemagick
RUN mkdir /usr/local/rails-app
WORKDIR /usr/local/rails-app
ADD Gemfile Gemfile
ADD Gemfile.lock Gemfile.lock
RUN bundle install
@infinityhacks
infinityhacks / aacs.py
Created June 3, 2018 12:28 — forked from fffonion/aacs.py
Anti-anti-crawler scripts
import re
import time
mkcookie = lambda coo: ";".join(["%s=%s" % (k,v) for k,v in coo.iteritems()])
def autodetect(resp, ct, ht, cookie, headers, url):
__func = None
while 'set-cookie' in resp:
coostr = resp['set-cookie']
_session = re.findall('yunsuo_session_verify=(\w+)', coostr)
.modal.fade.modal-fade
.modal-dialog
.modal-content
.modal-header
%button.close{type:'button', data:{dismiss:'modal'}}
%span{aria:{hidden:'true'}}
%i.fa.fa-close
%span.sr-only Close
%h4.modal-title
.modal-body