Blog

  • Swifty

    Swifty – Make swift code swifty

    中文 | English

    CI Status Version License Platform

    一、 示例程序

    To run the example project, clone the repo, and run pod install from the Example directory first.

    二、 CocoaPods 完整安装

    pod 'RyukieSwifty'

    三、 按功能安装

    3.1 UIKit Extension

    pod 'RyukieSwifty/UIKit'

    3.2 CloudKit Extension

    pod 'RyukieSwifty/CloudKit'

    3.3 Foundation Extension

    pod 'RyukieSwifty/Foundation'

    3.4 横竖屏切换

    pod 'RyukieSwifty/FullScreen'
    import UIKit
    import RyukieSwifty
    
    class FullScreenViewController: UIViewController {
    
        override func viewDidLoad() {
            super.viewDidLoad()
            setupUI()
        }
        
        // MARK: - Life
        override func viewWillDisappear(_ animated: Bool) {
            super.viewWillDisappear(animated)
            swifty.exitFullScreen()
        }
        
        override func viewWillAppear(_ animated: Bool) {
            super.viewWillAppear(animated)
            swifty.needFullScreen()
        }
        
        override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {
            super.viewWillTransition(to: size, with: coordinator)
            if size.width > size.height {
                switchButton.isSelected = true
            } else {
                switchButton.isSelected = false
            }
        }
        // MARK: - Function-Public
        
        // MARK: - Function-Private
        
        // MARK: UI
        private func setupUI() {
            view.backgroundColor = .white
            
            switchButton
                .added(to: view)
                .layout { make in
                    make?.center.equalToSuperview()
                }
        }
        
        // MARK: Buiness
        
        // MARK: Action
        @objc
        private func switchAction() {
            switchButton.isSelected ? swifty.exitFullScreen() : swifty.enterFullScreen()
        }
        
        // MARK: Request
        
        // MARK: - VarLet-Public
        
        // MARK: - VarLet-Private
        private lazy var switchButton: UIButton = {
            return UIButton()
                .config {
                    $0.setTitleColor(.black, for: .normal)
                    $0.setTitle("切换为横屏", for: .normal)
                    $0.setTitle("切换为竖屏", for: .selected)
                    $0.addTarget(self, action: #selector(switchAction), for: .touchUpInside)
                }
        }()
    }
    
    extension AppDelegate {
        func application(_ application: UIApplication, supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask {
            return application.swifty.supportedInterfaceOrientations
        }
    }

    3.5 路由协议

    pod 'RyukieSwifty/Router'

    3.6 网络请求接口协议 – MoyaStyleProtocol

    通过该协议可以使 Swift 内容中的网络请求实现有 Moya 的风格,更加 Swifty,不依赖具体第三方网络库,易于切换拓展。

    pod 'RyukieSwifty/SwiftyServiceProtocol'

    3.7 截屏防护 (>= iOS13)

    极其轻量化的截屏防护方案,任何需要被保护的 View 作为子视图放入 ScreenShieldView 即可达到截屏时隐藏内容的效果。

    ScreenShield

    pod 'RyukieSwifty/ScreenShield'

    Swift – Demo:

    import UIKit
    import RyukieSwifty
    
    class ViewController: UIViewController {
        override func loadView() {
            view = ScreenShieldView.create()
        }
        ...
    }

    OC – Demo:

    #import "OCScreenShieldViewController.h"
    @import RyukieSwifty;
    
    @interface OCScreenShieldViewController ()
    
    @end
    
    @implementation OCScreenShieldViewController
    
    - (void)loadView {
        self.view = [ScreenShieldView createWithFrame:UIScreen.mainScreen.bounds];
    }
    
    - (void)viewDidLoad {
        [super viewDidLoad];
        
        UIView *cubeView = [[UIView alloc] initWithFrame:CGRectMake(100, 100, 100, 100)];
        cubeView.backgroundColor = [UIColor redColor];
        [self.view addSubview:cubeView];
        
        self.view.backgroundColor = [UIColor grayColor];
    }
    
    @end

    四、 作者

    RyukieSama, ryukie.sama@gmail.com

    License

    Swifty is available under the MIT license. See the LICENSE file for more info.

    Visit original content creator repository https://github.com/RyukieSama/Swifty
  • Swifty

    Swifty – Make swift code swifty

    中文 | English

    CI Status Version License Platform

    一、 示例程序

    To run the example project, clone the repo, and run pod install from the Example directory first.

    二、 CocoaPods 完整安装

    pod 'RyukieSwifty'

    三、 按功能安装

    3.1 UIKit Extension

    pod 'RyukieSwifty/UIKit'

    3.2 CloudKit Extension

    pod 'RyukieSwifty/CloudKit'

    3.3 Foundation Extension

    pod 'RyukieSwifty/Foundation'

    3.4 横竖屏切换

    pod 'RyukieSwifty/FullScreen'
    import UIKit
    import RyukieSwifty
    
    class FullScreenViewController: UIViewController {
    
        override func viewDidLoad() {
            super.viewDidLoad()
            setupUI()
        }
        
        // MARK: - Life
        override func viewWillDisappear(_ animated: Bool) {
            super.viewWillDisappear(animated)
            swifty.exitFullScreen()
        }
        
        override func viewWillAppear(_ animated: Bool) {
            super.viewWillAppear(animated)
            swifty.needFullScreen()
        }
        
        override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {
            super.viewWillTransition(to: size, with: coordinator)
            if size.width > size.height {
                switchButton.isSelected = true
            } else {
                switchButton.isSelected = false
            }
        }
        // MARK: - Function-Public
        
        // MARK: - Function-Private
        
        // MARK: UI
        private func setupUI() {
            view.backgroundColor = .white
            
            switchButton
                .added(to: view)
                .layout { make in
                    make?.center.equalToSuperview()
                }
        }
        
        // MARK: Buiness
        
        // MARK: Action
        @objc
        private func switchAction() {
            switchButton.isSelected ? swifty.exitFullScreen() : swifty.enterFullScreen()
        }
        
        // MARK: Request
        
        // MARK: - VarLet-Public
        
        // MARK: - VarLet-Private
        private lazy var switchButton: UIButton = {
            return UIButton()
                .config {
                    $0.setTitleColor(.black, for: .normal)
                    $0.setTitle("切换为横屏", for: .normal)
                    $0.setTitle("切换为竖屏", for: .selected)
                    $0.addTarget(self, action: #selector(switchAction), for: .touchUpInside)
                }
        }()
    }
    
    extension AppDelegate {
        func application(_ application: UIApplication, supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask {
            return application.swifty.supportedInterfaceOrientations
        }
    }

    3.5 路由协议

    pod 'RyukieSwifty/Router'

    3.6 网络请求接口协议 – MoyaStyleProtocol

    通过该协议可以使 Swift 内容中的网络请求实现有 Moya 的风格,更加 Swifty,不依赖具体第三方网络库,易于切换拓展。

    pod 'RyukieSwifty/SwiftyServiceProtocol'

    3.7 截屏防护 (>= iOS13)

    极其轻量化的截屏防护方案,任何需要被保护的 View 作为子视图放入 ScreenShieldView 即可达到截屏时隐藏内容的效果。

    ScreenShield

    pod 'RyukieSwifty/ScreenShield'

    Swift – Demo:

    import UIKit
    import RyukieSwifty
    
    class ViewController: UIViewController {
        override func loadView() {
            view = ScreenShieldView.create()
        }
        ...
    }

    OC – Demo:

    #import "OCScreenShieldViewController.h"
    @import RyukieSwifty;
    
    @interface OCScreenShieldViewController ()
    
    @end
    
    @implementation OCScreenShieldViewController
    
    - (void)loadView {
        self.view = [ScreenShieldView createWithFrame:UIScreen.mainScreen.bounds];
    }
    
    - (void)viewDidLoad {
        [super viewDidLoad];
        
        UIView *cubeView = [[UIView alloc] initWithFrame:CGRectMake(100, 100, 100, 100)];
        cubeView.backgroundColor = [UIColor redColor];
        [self.view addSubview:cubeView];
        
        self.view.backgroundColor = [UIColor grayColor];
    }
    
    @end

    四、 作者

    RyukieSama, ryukie.sama@gmail.com

    License

    Swifty is available under the MIT license. See the LICENSE file for more info.

    Visit original content creator repository https://github.com/RyukieSama/Swifty
  • mclv-48v-300w-an1292-dspic33ck256mp508

    image

    Sensorless FOC using PLL Estimator for PMSM : MCLV-48V-300W and dsPIC33CK256MP508 Motor Control DIM

    1. INTRODUCTION

    This document describes the setup requirements for driving a Permanent Magnet Synchronous Motor (PMSM) using Sensorless Field Oriented Control (FOC) and PLL Estimator Algorithms on the hardware platform MCLV-48V-300W Inverter Board and dsPIC33CK256MP508 Motor Control Dual In-line Module (DIM).

    For details about PLL estimator refer to Microchip application note AN1292 “Sensorless Field Oriented Control (FOC) for a Permanent Magnet Synchronous Motor (PMSM) Using a PLL Estimator and Field Weakening (FW)”


    2. SUGGESTED DEMONSTRATION REQUIREMENTS

    2.1 Motor Control Application Firmware Required for the Demonstration

    To clone or download this application firmware on GitHub,

    • Navigate to the main page of this repository and
    • On the tab <> Code, above the list of files in the right-hand corner, click Code, then from the menu, click Download ZIP or copy the repository URL to clone.

    Note:
    In this document, hereinafter this firmware package is referred as firmware.

    2.2 Software Tools Used for Testing the firmware

    • MPLAB® X IDE v6.00
    • DFP: dsPIC33CK-MP_DFP v1.9.228
    • MPLAB® XC16 Compiler v2.00
    • MPLAB® X IDE Plugin: X2C-Scope v1.3.3

    Note:
    The software used for testing the firmware prior to release is listed above. It is recommended to use the version listed above or later versions for building the firmware.

    2.3 Hardware Tools Required for the Demonstration

    • MCLV-48V-300W Inverter Board (EV18H47A)
    • dsPIC33CK256MP508 Motor Control Dual In-line Module (EV62P66A)
    • 24V Power Supply (AC002013)
    • 24V 3-Phase Brushless DC Motor (AC300020)

    Note:
    All items listed under the section Hardware Tools Required for the Demonstration are available at microchip DIRECT


    3. HARDWARE SETUP

    This section describes hardware setup required for the demonstration.

    1. Motor currents are amplified on the MCLV-48V-300W Inverter Board; it can also be amplified by the amplifiers internal to the dsPIC33CK256MP508 on the DIM. The firmware and DIM are configured to sample and convert internal amplifier outputs (‘internal op-amp configuration’) by default to measure the motor currents needed to implement FOC.Table-1 summarizes the resistors to be populated and removed to convert the DIM from ‘internal op-amp configuration’ to ‘external op-amp configuration’ or vice versa.

    2. Insert the dsPIC33CK256MP508 Motor Control DIM into the DIM Interface connector J8 on the MCLV-48V-300W Inverter Board. Make sure the DIM is placed correctly and oriented before going ahead.

    3. Connect the 3-phase wires from the motor to PHC, PHB, and PHA of the connector J4(no specific order), provided on the MCLV-48V-300W Inverter Board.

    4. Plug the 24V power supply to connector J1 on the MCLV-48V-300W Inverter Board. Alternatively, the Inverter Board can also be powered through connector J3.

    5. The board has an onboard programmer PICkit™ On Board (PKoBv4) , which can be used for programming or debugging the microcontroller or dsPIC DSC on the DIM. To use the onboard programmer, connect a micro-USB cable between the Host PC and connector J16 on the MCLV-48V-300W Inverter Board.

    6. Alternatively, connect the Microchip programmer/debugger MPLAB® PICkit™ 4 In-Circuit Debugger between the Host PC used for programming the device and the ICSP header J9 on the MCLV-48V-300W Inverter Board (as shown). Ensure that PICkit 4 is oriented correctly before proceeding.


    4. SOFTWARE SETUP AND RUN

    4.1 Setup: MPLAB X IDE and MPLAB XC16 Compiler

    Install MPLAB X IDE and MPLAB XC16 Compiler versions that support the device dsPIC33CK256MP508 and PKOBv4. The MPLAB X IDE, MPLAB XC16 Compiler, and X2C-Scope plug-in used for testing the firmware are mentioned in the Motor Control Application Firmware Required for the Demonstration section.

    To get help on

    • MPLAB X IDE installation, refer link
    • MPLAB XC16 Compiler installation steps, refer link

    If MPLAB IDE v8 or earlier is already installed on your computer, then run the MPLAB driver switcher (Installed when MPLAB®X IDE is installed) to switch from MPLAB IDE v8 drivers to MPLAB X IDE drivers. If you have Windows 8 or 10, you must run the MPLAB driver switcher in Administrator Mode. To run the Device Driver Switcher GUI application as administrator, right-click on the executable (or desktop icon) and select Run as Administrator. For more details, refer to the MPLAB X IDE help topic “Before You Begin: Install the USB Device Drivers (For Hardware Tools): USB Driver Installation for Windows Operating Systems.”

    4.2 Setup: X2C-SCOPE

    X2C-Scope is an MPLAB X IDE plugin that allows developers to interact with an application while it runs. X2C-Scope enables you to read, write, and plot global variables (for motor control) in real-time. It communicates with the target using the UART. To use X2C-Scope, the plugin must be installed. To set up and use X2C-Scope, refer to the instructions provided on the web page.

    5. BASIC DEMONSTRATION

    5.1 Firmware Description

    The firmware version needed for the demonstration is mentioned in the section Motor Control Application Firmware Required for the Demonstration section. This firmware is implemented to work on Microchip’s 16-bit Digital signal controller (dsPIC® DSC) dsPIC33CK256MP508. For more information, see the dsPIC33CK256MP508 Family datasheet (DS70005349).

    The Motor Control Demo application uses a push button to start or stop the motor and a potentiometer to vary the speed of the motor. This Motor Control Demo Application configures and uses peripherals like PWM, ADC, UART, etc. For more details, refer to Microchip Application note AN1292, “Sensorless Field Oriented Control (FOC) for a Permanent Magnet Synchronous Motor (PMSM) Using a PLL Estimator and Field Weakening (FW),” available on the Microchip website.

    Note:
    The project may not build correctly in Windows OS if the Maximum path length of any source file in the project is more than 260 characters. In case the absolute path exceeds or nears the maximum length, do any (or both) of the following:

    • Shorten the directory name containing the firmware used in this demonstration. If you renamed the directory, consider the new name while reading the instructions provided in the upcoming sections of the document.
    • Place firmware in a location such that the total path length of each file included in the projects does not exceed the Maximum Path length specified.
      Refer to MPLAB X IDE help topic “Path, File, and Folder Name Restrictions” for details.

    5.2 Basic Demonstration

    Follow the below instructions, step by step, to set up and run the motor control demo application:

    1. Start MPLAB X IDE and open the project pmsm.X (File > Open Project) with device selection dsPIC33CK256MP508.

    2. Set the project pmsm.X as the main project by right-clicking on the project name and selecting Set as Main Project as shown. The project pmsm.X will then appear in bold.

    3. Open userparms.h (pmsm.X > Header Files) in the project pmsm.X.

      • Ensure that the macros TUNING, OPEN_LOOP_FUNCTIONING, TORQUE_MODE, and SINGLE_SHUNT is not defined in the header file userparms.h.

      • When internal amplifiers are used for current amplification (referred to as internal op-amp configuration), define the macro INTERNAL_OPAMP_CONFIG in userparms.h.

      • Otherwise, if external amplifiers are used for current amplification (referred to as external op-amp configuration), undefine the macro INTERNAL_OPAMP_CONFIG in the header file userparms.h.

    Note:
    The motor phase currents can be reconstructed from the DC Bus current by appropriately sampling it during the PWM switching period, called a single-shunt reconstruction algorithm. The firmware can be configured to demonstrate the single shunt reconstruction algorithm by defining the macro SINGLE_SHUNT in the header file userparms.h For additional information, refer to Microchip application note AN1299, “Single-Shunt Three-Phase Current Reconstruction Algorithm for Sensorless FOC of a PMSM.” By default, the firmware uses phase currents measured across the phase shunt resistors on two of the half-bridges of the three-phase inverter (‘dual shunt configuration’) to implement FOC.

    1. Right-click on the project pmsm.X and select Properties to open its Project Properties Dialog. Click the Conf:[default] category to reveal the general project configuration information. The development tools used for testing the firmware are listed in section 2.2 Software Tools Used for Testing the firmware..

      In the Conf:[default] category window:

      • Ensure the selected Device is dsPIC33CK256MP508.
      • Select the Connected Hardware Tool to be used for programming and debugging.
      • Select the specific Device Family Pack (DFP) from the available list of Packs. In this case, dsPIC33CK-MP_DFP 1.9.228 is selected.
      • Select the specific Compiler Toolchain from the available list of XC16 compilers. In this case, XC16(v2.00) is selected.
      • After selecting Hardware Tool and Compiler Toolchain, Device Pack, click the button Apply

      Please ensure that the selected MPLAB® XC16 Compiler and Device Pack support the device configured in the firmware

    2. Ensure that the checkbox Load symbols when programming or building for production (slows process) is checked under the Loading category of the Project Properties window.

    3. To build the project (in this case, pmsm.X) and program the device dsPIC33CK256MP508, click Make and Program Device Main project on the toolbar

    4. If the device is successfully programmed, LD2 (LED1) will be turned ON, indicating that the dsPIC® DSC is enabled.

    5. Run or stop the motor by pressing the push button SW1. The motor should start spinning smoothly in one direction in the nominal speed range. Ensure that the motor is spinning smoothly without any vibration. The LED LD3(LED2) is turned ON to show the button is pressed to start the motor.

    6. The motor speed can be varied using the potentiometer (POT1).

    7. Press the push button SW2 to enter the extended speed range (NOMINAL_SPEED_RPM to MAXIMUM_SPEED_RPM). Press the push button SW2 again to revert the speed of the motor to its nominal speed range (END_SPEED_RPM to NOMINAL_SPEED_RPM).

    8. Press the push button SW1 to stop the motor.

    Note:
    The macros END_SPEED_RPM, NOMINAL_SPEED_RPM, and MAXIMUM_SPEED_RPM are specified in the header file userparms.h included in the project pmsm.X. The macros NOMINAL_SPEED_RPM and MAXIMUM_SPEED_RPM are defined as per the Motor manufacturer’s specifications. Exceeding manufacture specifications may damage the motor or the board or both.

    5.3 Data visualization through X2C-Scope Plug-in of MPLAB X

    X2C-Scope is a third-party plug-in in MPLAB X, which helps in real-time diagnostics. The application firmware comes with the initialization needed to interface the controller with the host PC to enable data visualization through the X2C-Scope plug-in. Ensure the X2C-Scope plug-in is installed. For more information on how to set up a plug-in, refer to either the Microchip Developer Help page or the web page.

    1. To establish serial communication with the host PC, connect a micro-USB cable between the host PC and connector J16 on the MCLV-48V-300W Inverter Board. This interface is also used for programming.

    2. Ensure the application is configured and running as described under section 5.2 Basic Demonstration by following steps 1 through 11.

    3. Open the X2C-Scope window by selecting Tools>Embedded>X2CScope.

    4. In the X2C-Scope Configuration window, open the Connection Setup tab and click Select Project. This opens the drop-down menu Select Project with a list of opened projects. Select the specific project pmsm from the list of projects and click OK.

    5. To configure and establish the serial communication for X2C-Scope, open the X2CScope Configuration window, click on the Connection Setup tab and:

      • Set Baudrate as 115200, which is configured in the application firmware.
      • Click on the Refresh button to refresh and update the list of the available Serial COM ports connected to the Host PC.
      • Select the specific Serial port detected when interfaced with the MCLV-48V-300W Inverter Board. The Serial port depends on the system settings

    6. Once the Serial port is detected, click on Disconnected and turn to Connected, to establish serial communication between the Host PC and the board.

    7. Open the Project Setup tab in the X2CScope Configuration window and,

      • Set Scope Sampletime as the interval at which X2CScopeUpdate() is called. In this application, it is every 50µs.
      • Then, click Set Values to save the configuration.

    8. Click on Open Scope View (in the Data Views tab of the X2CScope Configuration Window); this opens Scope Window.

    9. In the Scope Window, select the variables that must be watched. To do this, click on the Source against each channel, and a window Select Variables opens on the screen. From the available list, the required variable can be chosen. Ensure checkboxes Enable and Visible are checked for the variables to be plotted. To view data plots continuously, uncheck Single-shot. When Single-shot is checked, it captures the data once and stops. The Sample time factor value multiplied by Sample time decides the time difference between any two consecutive data points on the plot.

    10. Click on SAMPLE, then the X2C-Scope window plots variables in real-time, which updates automatically.

    11. Click on ABORT to stop.

    6. REFERENCES:

    For additional information, refer following documents or links.

    1. AN1292 Application Note “Sensorless Field Oriented Control (FOC) for a Permanent Magnet Synchronous Motor (PMSM) Using a PLL Estimator and Field Weakening (FW)
    2. AN1299 Application Note “Single-Shunt Three-Phase Current Reconstruction Algorithm for Sensorless FOC of a PMSM
    3. MCLV-48V-300W Inverter Board User’s Guide (DS50003297)
    4. dsPIC33CK256MP508 Motor Control Dual In-Line Module (DIM) Information Sheet (DS50003063)
    5. dsPIC33CK256MP508 Family datasheet (DS70005349)
    6. Family Reference manuals (FRM) of dsPIC33CK256MP508 family
    7. MPLAB® X IDE User’s Guide (DS50002027) or MPLAB® X IDE help
    8. MPLAB® X IDE installation
    9. MPLAB® XC16 Compiler installation
    10. Installation and setup of X2Cscope plugin for MPLAB X
    Visit original content creator repository https://github.com/microchip-pic-avr-solutions/mclv-48v-300w-an1292-dspic33ck256mp508
  • reddit_karma_farmer_auto_poster_with_AI

    AIhawk

    LinkedIn Gmail

    Reddit_Poster_AIHawk


    🚀 Join the AIHawk Community 🚀

    Connect with like-minded individuals and get the most out of AIHawk.

    💡 Get support: Ask questions, troubleshoot issues, and find solutions.

    🗣️ Share knowledge: Share your experiences, tips, and best practices.

    🤝 Network: Connect with other professionals and explore new opportunities.

    🔔 Stay updated: Get the latest news and updates on AIHawk.

    Join Now 👇

    Telegram

    Table of Contents

    Introduction

    The Reddit Post Generator is a Python script designed to automatically generate and post content on Reddit. By analyzing trending subreddits and top posts, the script creates innovative posts tailored to maximize engagement and upvotes. It uses OpenAI’s GPT models and LangChain to generate content based on specific rules and summaries.

    Features

    • Automatic Reddit Posting: Posts are generated and submitted to trending subreddits.
    • Customizable Content Generation: Utilizes various post types such as clickbait, humorous, question-oriented, and more.
    • Error Handling: Robust error management for posting failures, rate limits, and subreddit restrictions.
    • Randomized Posting Intervals: Avoids detection of automated behavior by introducing random sleep intervals.

    Installation

    To set up and use the Reddit Post Generator, follow these steps:

    1. Clone the Repository

      git clone https://github.com/feder-cr/reddit_karma_farmer_auto_poster_with_AI.git
      cd reddit_karma_farmer_auto_poster_with_AI
    2. Create a Virtual Environment (optional but recommended)

      python -m venv venv
      source venv/bin/activate   # On Windows use `venv\Scripts\activate`
    3. Install Dependencies

      pip install -r requirements.txt

    Configuration

    To generate Reddit API keys, follow these steps:

    1. Create a Reddit Account:

      • If you don’t already have a Reddit account, sign up at reddit.com.
    2. Register a New Application:

      • Go to Reddit App Preferences.
      • Scroll down to “Developed Applications” and click “Create App”.
      • Fill out the form:
        • name: Choose a name for your app.
        • App type: Select “script” for personal use.
        • description: Optional, add a description of your app.
        • about url: Leave blank.
        • permissions: Leave blank.
        • callback url: Set to http://localhost:8000 (or any URL you prefer for local testing).
        • permissions: Select read and submit.
      • Click “Create app”.
    3. Obtain Your API Credentials:

      • Once created, you’ll be able to see your client_id and client_secret.
      • Use these credentials in your config_secrets.py file under the Reddit section.
    4. config_secrets.py:

      • This file contains your sensitive credentials and API keys. It should be placed in the same directory as your main script. Make sure to replace the placeholder values with your actual credentials.
      CLIENT_ID = 'YOUR_REDDIT_CLIENT_ID'
      CLIENT_SECRET = 'YOUR_REDDIT_CLIENT_SECRET'
      USERNAME = 'YOUR_REDDIT_USERNAME'
      PASSWORD = 'YOUR_REDDIT_PASSWORD'
      OPENAI_KEY = 'YOUR_OPENAI_API_KEY'
      • Explanation:
        • CLIENT_ID: Your Reddit application’s client ID.
        • CLIENT_SECRET: Your Reddit application’s client secret.
        • USERNAME: Your Reddit username.
        • PASSWORD: Your Reddit account password.
        • OPENAI_KEY: Your OpenAI API key.

      Important: Ensure this file is kept private and not shared or committed to version control to protect your sensitive information.

    Usage

    To use the Reddit Post Generator, execute the script main.py. Ensure that the configuration files are correctly set up before running the script.

    python main.py

    Conclusion

    The Reddit Post Generator is a powerful tool for automating Reddit content creation. By leveraging AI-driven content generation and automation, users can engage with trending topics and generate content that maximizes interaction.

    Contributors

    • feder-cr – Creator and Lead Developer

    License

    This project is licensed under the MIT License. See the LICENSE file for details.

    Disclaimer

    The use of this script for posting on Reddit is subject to Reddit’s API terms of service. The script is provided “as-is” without any warranties or guarantees. For educational and demonstrative purposes only, this script is intended to showcase how Reddit automation might work and is not recommended for real-world use.

    Using this script for actual Reddit posting could lead to account suspension or other penalties if it violates Reddit’s guidelines or terms of service. Always use automation responsibly and ensure compliance with Reddit’s rules and policies.

    We strongly discourage the use of this script for real-world applications and advise against deploying it for any production or large-scale posting activities.

    Visit original content creator repository https://github.com/feder-cr/reddit_karma_farmer_auto_poster_with_AI
  • SimpleReddit

    No distractions. No comments sections. No stylesheets. No JavaScript.

    Just an HTML-only Reddit client to stop you entering an internet time vortex.

    FAQs

    Why did you make this?

    I wanted a quick way to check Reddit, stay up-to-date and read interesting things without getting distracted.

    If I intentionally want to go down a Reddit rabbithole, I’ll browse it via Libreddit (which is still a lot better than the normal Reddit UI!)

    Why is there no CSS or JavaScript?

    Why should there be CSS or JavaScript? I think the site works just fine, and it’s a bit of a proof to myself and others that you can make a perfectly functional and usable site using the powers of plain HTML alone.

    Are you sure there’s no CSS or JS? Not even a sneaky little style=""?

    There’s none! For proof, here’s the site’s Content-Security-Policy:

    default-src 'none'; img-src https://simplereddit.ethan.link/favicon.ico
    

    This means the allowed sources for scripts and styles is 'none', so even if there was any CSS or JS on the page (including via attributes), the browser would refuse to run it!

    How/where does this run?

    It’s a single no-dependency JavaScript file intended to be deployed via Cloudflare Workers. It should be pretty easy port to any hosting/infrastructure though, as it’s a single JS file that can be easily adapted.

    Can I self-host this?

    Sure! To host on your own Cloudflare account, just clone the repo, update the details in wrangler.toml, then run wrangler publish in your terminal.

    If you want to self-host elsewhere, it shouldn’t be too hard to adapt the JS file, the only things that will need changing is where handleRequest is called from, and possibly the method used to return HTTP responses.

    Can I contribute?

    Since it’s a fairly small-scale project, I’m not sure how many things there are that need doing! But if you have any ideas or find any bugs, feel free to leave an issue or pull request.

    If you enjoy SimpleReddit and want to leave a small tip, you can ☕ buy me a coffee.

    Visit original content creator repository
    https://github.com/Booligoosh/SimpleReddit

  • kubectl

    kubectl

    Packaging for the kubectl Kubernetes client
    (https://github.com/kubernetes/kubernetes/tree/master/cmd/kubectl).

    Installation

    Debian-like distributions

    1. Update the apt package index and install packages needed to use the
      kubectl apt repository. The following steps assume that your apt
      package version is 2.3.10 or greater.

      sudo apt-get update
      sudo apt-get install --assume-yes "ca-certificates"
    2. Install the sources.list(5) file for the kubectl apt repository.

      cat << _EOF_ | sudo tee "/etc/apt/sources.list.d/kubectl.sources"
      Types: deb
      URIs: https://cavcrosby.github.io/kubectl/deb
      Suites: all
      Components: main
      Architectures-Remove: i386
      Signed-By:
       -----BEGIN PGP PUBLIC KEY BLOCK-----
       .
       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
       =TVJp
       -----END PGP PUBLIC KEY BLOCK-----
    3. Update the apt package index, then install kubectl.

      sudo apt-get update
      sudo apt-get install --assume-yes "kubectl"

    License

    See LICENSE.

    Visit original content creator repository
    https://github.com/cavcrosby/kubectl-pkg-repo

  • AVR-mini-projects

    AVR Mini Projects

    This repository presents various projects developed to enhance my skills in dealing with 8-bit microcontrollers such as the ATmega32. It includes implementations of drivers for microcontroller peripherals and some simple applications.

    Projects List

    1. Stop Watch
    2. Temperature Controlled Fan
    3. Ultrasonic Distance Measurement
    4. Soon 🙂

    How to Use the Repository

    Prerequisites

    • AVR-GCC
    • Make
    • avrdude (for flashing the microcontroller)

    Directory Structure

    • src/: application code/ main function
    • Common/: types of target and common useful macros
    • HAL/: Hardware Abstraction Layer implementation
    • MCAL/: Microcontroller Abstraction Layer implementation
    • Simulator/: schematic design of the project for validation
    • Debug/: .elf file to be flashed

    Setting Up the Development Environment

    1. Install AVR-GCC:
      • On Debian/Ubuntu: sudo apt-get install gcc-avr avr-libc
      • On macOS: brew tap osx-cross/avr && brew install avr-gcc
      • On Windows: Install AVR-GCC
        • Download and install the AVR-GCC package from the link.
        • Ensure the AVR-GCC binaries are added to your system PATH.
    2. Install Make:
      • On Debian/Ubuntu: sudo apt-get install make
      • On macOS: brew install make
      • On Windows: Install Make for Windows:
        • Download and install Make from the link.
        • Ensure the Make binaries are added to your system PATH.
    3. Clone the repository:

      git clone https://github.com/hussein-shamy/AVR-mini-projects.git
      cd AVR-mini-projects
      
    4. Build the project:
      make
      
    5. Flash the firmware:
      make flash
      

    Visit original content creator repository
    https://github.com/hussein-shamy/AVR-mini-projects

  • fourdadmin

    FourD Admin

    A 4D Database Admin Web App.

    Build Status MIT license Dependency Status devDependency Status

    This web app is built upon the TeamMaestro Angular seed.

    This web app allows users to directly browse a 4D Database backend and create/edit/delete records. It also provides a 4D Choice List Editor.

    Handle with GREAT CARE. The app already validates that user has Admin privileges, but I’d be VERY CAREFUL making this web app available on a production site! MOST SPECIALLY ON A PUBLIC ACCESSIBLE WEB SITE. It is great for development and testing, though.

    The distribution folder includes a built version of the FourDAdmin web app. You can download the .zip file in there and copy its contents to a subfolder in your application’s Webfolder. If you have the RESTApi Component installed in your 4D structure, you will be able to browse and edit your database records and choice lists.

    There is also an experimental mobile version with basically the same functionality, except for editing records in the database. see

    And do not forget to look at additional, more detailed, documentation on the wiki pages.

    Browse Table Records

    Edit Records

    Edit 4D Choice List

    It relies on Pascal’s 4D RESTApi being installed on the 4D Database backend.

    Contributors

    Julio Carneiro
    Julio Carneiro
    Visit original content creator repository https://github.com/fourctv/fourdadmin
  • ss-spa

    Docker Pulls Docker Stars Docker Layers

    Welcome

    SuperScript Single Page Application is

    • Easy to bootstrap SuperScript.
    • Embrace WeakAI in minutes.
    • Adopt chatbot quickly.

    Deps

    Node.js v7.1.6+ (leverage async/await) MongoDB

    Usage

    git clone https://github.com/Samurais/ss-spa.git
    cd ss-spa
    npm install
    bower install
    cp config/environment/development.sample.js config/environment/development.js
    cp config/log4js.sample.json config/log4js.json
    npm start
    open http://localhost:3001
    

    Watch

    Re-parse and restart app when editing chat’s scripts.

    npm run dev:start
    

    Note, in the browser, socket.io would reconnect to server when the app is restarted, it avoids reloading client page.

    Test

    npm run dev:start
    npm test
    

    npm test — –watch # to run testcase lively.

    Thanks to

    WebRTC chat with React.js

    SuperScript

    Wechaty

    Docker

    To start app with docker-compose.

    ./scripts/start-docker-spa.sh
    open http://localhost:3001
    

    Note, samurais/ss-spa:0.0.1 can be built locally.

    ./scripts/build-docker-image.sh
    

    Work with Wechaty

    ss-spa can connect to your wechat personal account in minutes with ss-wechaty.

    git clone git@github.com:Chatie/ss-wechaty.git && cd ss-wechaty
    scripts/start-docker-compose.sh
    

    License

    MIT

    Visit original content creator repository https://github.com/hailiang-wang/ss-spa
  • ss-spa

    Docker Pulls Docker Stars Docker Layers

    Welcome

    SuperScript Single Page Application is

    • Easy to bootstrap SuperScript.
    • Embrace WeakAI in minutes.
    • Adopt chatbot quickly.

    Deps

    Node.js v7.1.6+ (leverage async/await) MongoDB

    Usage

    git clone https://github.com/Samurais/ss-spa.git
    cd ss-spa
    npm install
    bower install
    cp config/environment/development.sample.js config/environment/development.js
    cp config/log4js.sample.json config/log4js.json
    npm start
    open http://localhost:3001
    

    Watch

    Re-parse and restart app when editing chat’s scripts.

    npm run dev:start
    

    Note, in the browser, socket.io would reconnect to server when the app is restarted, it avoids reloading client page.

    Test

    npm run dev:start
    npm test
    

    npm test — –watch # to run testcase lively.

    Thanks to

    WebRTC chat with React.js

    SuperScript

    Wechaty

    Docker

    To start app with docker-compose.

    ./scripts/start-docker-spa.sh
    open http://localhost:3001
    

    Note, samurais/ss-spa:0.0.1 can be built locally.

    ./scripts/build-docker-image.sh
    

    Work with Wechaty

    ss-spa can connect to your wechat personal account in minutes with ss-wechaty.

    git clone git@github.com:Chatie/ss-wechaty.git && cd ss-wechaty
    scripts/start-docker-compose.sh
    

    License

    MIT

    Visit original content creator repository https://github.com/hailiang-wang/ss-spa