Skip to content

Instantly share code, notes, and snippets.

@ii0
ii0 / README.md
Created October 8, 2022 13:13 — forked from maboloshi/README.md
[Mac下配置Aria2] #macOS #aria2

Mac下配置Aria2

安装和设置 Aria2

# 使用 Homebrew 安装 aria2
brew install aria2

# 创建配置文件aria2.conf和空对话文件aria2.session
mkdir ~/.aria2 && cd ~/.aria2
touch aria2.conf
@ii0
ii0 / webshell.py
Created September 28, 2022 00:43 — forked from phoemur/webshell.py
Basic webshell with Python + Flask and WebSockets (Flask-SocketIO)
#!/usr/bin/env python
import subprocess
from flask import Flask, render_template
from flask_socketio import SocketIO, send, emit
HTML = '''
<html>
<head>
<title>WEBSHELL</title>
@ii0
ii0 / nginx.conf
Created August 2, 2022 01:52 — forked from sunwu51/nginx.conf
openresty配置详解
# 概述:一共三大部分配置。
# 其中#注释掉的可以在需要的时候开启并修改,没有注释掉的(除了下面location示例)不要删掉,基本都是必须的配置项。
###############################第一部分 全局配置############################
#user nobody; 指定启动进程的用户,默认不用指定即可。
#error_log logs/error.log; 配置日志输出,虽然叫error_log但是可以定义输出的级别,默认不写是ERROR级别
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid; 记录pid的文件,默认就是放到这个位置,可以修改。
@ii0
ii0 / example-output.md
Created June 9, 2022 09:13 — forked from bwbaugh/example-output.md
Generate a randomly connected graph with N nodes and E edges.

Example output

Minimum number of edges

python random_connected_graph.py -p -g names.gml names.txt

Console

@ii0
ii0 / Path Finding Algorithms.cpp
Created May 3, 2022 03:31 — forked from OmarElgabry/Path Finding Algorithms.cpp
Implementation of BFS, DFS(Recursive & Iterative), Dijkstra, Greedy, & Astart Algorithms. These algorithms are used to search the tree and finding the shortest paths from starting node to goal node in the tree.
#include <cstdlib>
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <iterator>
#include <algorithm>
#include <math.h>
#include <sstream>
#include <cmath>
from PIL import Image, ImageDraw, ImageFont
import argparse
import numpy as np
sample_rate = 0.4
def ascii_art(file):
im = Image.open(file)
@ii0
ii0 / forms.py
Created April 26, 2021 15:31 — forked from maraujop/forms.py
django-crispy-forms bootstrap form example
# -*- coding: utf-8 -*-
from django import forms
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Layout, Div, Submit, HTML, Button, Row, Field
from crispy_forms.bootstrap import AppendedText, PrependedText, FormActions
class MessageForm(forms.Form):
text_input = forms.CharField()

Install Supervisor with sudo apt-get install supervisor in Unix or brew install supervisor in Mac OSX. Ensure it's started with sudo service supervisor restart in Unix or brew services start supervisor in Mac OSX.

In Unix in /etc/supervisord/conf.d/ create a .conf file. In this example, laravel_queue.conf (contents below). Give it execute permissions: chmod +x laravel_queue.conf.

In Mac OSX first run supervisord -c /usr/local/etc/supervisord.ini and in /usr/local/etc/supervisor.d/ create a .conf file. In this example, laravel_queue.conf (contents below). Give it execute permissions: chmod +x laravel_queue.conf.

This file points at /usr/local/bin/run_queue.sh, so create that file there. Give this execute permissions, too: chmod +x run_queue.sh.

Now update Supervisor with: sudo supervisorctl reread in Unix and with: brew services restart supervisor in MAc OSX . And start using those changes with: sudo supervisorctl update.

@ii0
ii0 / 01-package.py
Created April 12, 2021 14:11 — forked from WhiteRobe/01-package.py
0-1背包与完全背包
def time_test(repeat_times=5000):
"""
函数运行效率装饰器
@see https://blog.csdn.net/Shenpibaipao/article/details/88044951
:param repeat_times: 重复次数
:return: 原函数结果
"""
def func_acceptor(func):
def wrapper(*arg, **args):
import time
@ii0
ii0 / notify.py
Created July 16, 2020 06:11 — forked from lukaszb/notify.py
Simple Python script to send notification to the OSX Notifications Center (requires OS X 10.8+). Tested with pyobjc 2.5.1
#!/usr/bin/env python
from Foundation import NSUserNotification
from Foundation import NSUserNotificationCenter
from Foundation import NSUserNotificationDefaultSoundName
from optparse import OptionParser
def main():
parser = OptionParser(usage='%prog -t TITLE -m MESSAGE')