Skip to content

Instantly share code, notes, and snippets.

View nickfox-taterli's full-sized avatar
😰
想哭

Tater Li nickfox-taterli

😰
想哭
View GitHub Profile
@nickfox-taterli
nickfox-taterli / zhihu.php
Created October 18, 2019 06:16
ZhiHu Spider
<?php
require 'vendor/autoload.php';
$mongo = new MongoDB\Client("mongodb://taterli:f697bb912da7f4d210382c67@127.0.0.1:27017");
$db = $mongo->wa; //选择数据库
$collection = $db->zhihu; //选择文档集合
$next_qid = null; /* 首次 */
$first_qid = 0;
@nickfox-taterli
nickfox-taterli / pppoe.c
Created October 18, 2019 06:15
PPPoE Flood
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <net/if.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <netinet/ether.h>
#include <netpacket/packet.h>
#include <netinet/in.h>
#include <time.h>
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using System.Diagnostics;
<?php
while (true) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://auth.docker.io/token?scope=repository:imdevops/hfish:pull&service=registry.docker.io");
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$output = json_decode(curl_exec($ch), true);
curl_close($ch);
@nickfox-taterli
nickfox-taterli / ddns_scf.py
Created October 25, 2019 07:51
Tencent SCF DDNS
#!/usr/bin/env python
# -*- coding:utf-8 -*-
import base64
import hashlib
import hmac
import json
import random
from datetime import datetime
from urllib.parse import urlencode
@nickfox-taterli
nickfox-taterli / testmail.app.php
Created November 2, 2019 13:53
testmail.app PHP example
<?php
$graphql = '{
inbox(namespace: "prefix" tag:"") {
result message count emails {
id
namespace
tag
timestamp
@nickfox-taterli
nickfox-taterli / lambda_t2_credit.py
Created December 21, 2019 16:51
Get EC2 Credit @ Lambda
import json
import boto3
import datetime
def lambda_handler(event, context):
ec2 = dict()
cloudwatch = boto3.client('cloudwatch')
for metric in ['CPUUtilization', 'CPUCreditUsage', 'CPUCreditBalance']:
response = cloudwatch.get_metric_statistics(
Namespace = 'AWS/EC2',
@nickfox-taterli
nickfox-taterli / make_books.php
Created December 27, 2019 13:58
小说站单独做某一本书的TXT
<?php
require_once 'vendor/autoload.php';
error_reporting(0);
function make_books($url)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
@nickfox-taterli
nickfox-taterli / AWSCrossAccount.php
Created January 10, 2020 05:56
AWS Cross Account PHP Script
<?php
require 'vendor/autoload.php';
$credentials = new Aws\Credentials\Credentials('x', 'x');
$sts = new Aws\Sts\StsClient([
'version' => 'latest',
'region' => 'us-east-1',
'credentials' => $credentials
]);
@nickfox-taterli
nickfox-taterli / AWSCrossAccount.py
Created January 10, 2020 05:57
AWS Cross Account Python Script
import boto3
client = boto3.client('sts',region_name='us-east-1',aws_access_key_id='xxxx',aws_secret_access_key='xxxx')
response = client.assume_role(
RoleArn = 'arn:aws:iam::066600000000:role/xxx',
RoleSessionName = 'newsession',
DurationSeconds = 43200
)['Credentials']