Skip to content

Instantly share code, notes, and snippets.

View carry0987's full-sized avatar
:electron:

carry0987 carry0987

:electron:
View GitHub Profile
@carry0987
carry0987 / RPi3-Auto-WiFi.md
Last active April 26, 2024 11:58
Raspberry Pi 3B+ Auto reconnect to wifi when lost connect

Auto reconnect to wifi when lost connection

Before you start, make sure ip command is available on your system. In modern Linux distributions, ip replaces older ifconfig command. If net-tools package (that includes ifconfig) is not installed and you prefer using it, you can install it via sudo apt-get install net-tools.

Create script file

Use touch /home/pi/wifi-reconnect.sh to create a shell script file, with the following content:

#!/bin/bash
@carry0987
carry0987 / RPi3-Disable-Bluetooth-Or-WiFi-By-Default.md
Created July 30, 2018 13:42
RPi3-Disable-Bluetooth-Or-WiFi-By-Default

RPi3 Disable Bluetooth Or WiFi By Default

Step

  1. Use sudo mount /dev/mmcblk0p1 /mnt to mount SD Card

  2. Use sudo vim /mnt/config.txt to edit config

  3. Disable WiFi

@carry0987
carry0987 / data.py
Created July 5, 2023 07:45 — forked from primaryobjects/data.py
LLM ChatGPT prompt engineering accuracy statistics. Using F-score and accuracy to measure effectiveness of prompts for classification. https://learn.deeplearning.ai/chatgpt-prompt-eng/lesson/1/introduction
messages = [
{'content': 'I hate this food.', 'truth': 1},
{'content': 'This movie is terrible.', 'truth': 1},
{'content': 'I really like this play.', 'truth': 0},
{'content': 'I am just not sure.', 'truth': 0},
{'content': 'I can\'t believe you would do something like that!', 'truth': 1},
{'content': 'This is absolutely unacceptable!', 'truth': 1},
{'content': 'I am so angry right now, I can\'t even think straight.', 'truth': 1},
{'content': 'How could you be so thoughtless?', 'truth': 1},
{'content': 'You have no idea how much you\'ve hurt me.', 'truth': 1},
@carry0987
carry0987 / 1-setup.md
Created April 17, 2023 11:49 — forked from troyfontaine/1-setup.md
Signing your Git Commits using GPG on MacOS

Methods of Signing with a GPG Key on MacOS

Last updated September 21, 2022

This Gist explains how to do this using gpg in a step-by-step fashion. Previously, krypt.co was heavily mentioned, but I've only recently learned they were acquired by Akamai and no longer update their previous free products. Those mentions have been removed.

For using a GUI-based GIT tool such as Tower or Github Desktop, follow the steps here for signing your commits with GPG.

There has been a number of comments on this gist regarding some issues around the pinentry-program and M1 Macs. I've finally gotten a chance to try things out on an M1 and I've updated the documentation in 2-using-gpg.md to reflect my findings.

@carry0987
carry0987 / signing-git-commits.md
Created April 17, 2023 11:49 — forked from phortuin/signing-git-commits.md
Set up a GPG key for signing Git commits on MacOS (M1)

Based on this blogpost.

To sign Git commits, you need a gpg key. GPG stands for GNU Privacy Guard and is the de facto implementation of the OpenPGP message format. PGP stands for ‘Pretty Good Privacy’ and is a standard to sign and encrypt messages.

Setting up

Install with Homebrew:

$ brew install gpg
@carry0987
carry0987 / RPi3-TCP-BBR.md
Last active January 2, 2023 07:06
Raspberry Pi 3B+ Using BBR Congestion Control

Raspberry Pi 3B+ Using BBR Congestion Control

Check Kernel

uname -r

The kernel version should >= 4.9.4, if isn't, please follow the script below to update kernel:

Update Kernel

  1. sudo rpi-update
  2. sudo reboot
sleep-with-countdown() {
secs=$1
while [ $secs -gt 0 ]; do
printf "\rsleep: $secs\033[0K"
sleep 1
: $((secs--))
done
printf "\n"
}
@carry0987
carry0987 / hv_host.md
Created March 14, 2020 15:16
HV Host

HV Host List

Updated: 2019-09-29

Copy the belowing hosts into hosts file, and execute cmd, enter ipconfig/flushdns

213.227.140.199 alt.hentaiverse.org
104.20.27.25 e-hentai.org
104.20.26.25 e-hentai.org
104.20.134.21 g.e-hentai.org
104.20.135.21 g.e-hentai.org
@carry0987
carry0987 / Get-file-upload-progress-in-ajax-using-jquery.md
Last active January 23, 2020 14:34
Get File Upload Progress in Ajax using jQuery

Progress Bar helps to display the file upload status in real-time.
You can get the upload progress in Ajax and show the percentage progress bar using jQuery.
The progress bar is very useful to make the file upload process user-friendly.
The following code snippet shows how to get the file upload progress in Ajax and make a progress bar with percentage using jQuery.

  • Use xhr option in $.ajax() method to handle the progress bar operation.
  • Create a new XMLHttpRequest object using JavaScript window.XMLHttpRequest() method.
  • The progress event of XMLHttpRequest upload property allows to get the total and loaded length.
  • Calculate the percentage and handle the process bar.
<fieldset class="breadcrumb">
<span class="crumbs">
<span class="crust" itemscope="itemscope" itemtype="http://data-vocabulary.org/Breadcrumb">
<a href="{$base_url}" class="crumb" rel="up" itemprop="url">
<span class="crumb_img" itemprop="title">
<img class="breadcrumb_img" src="{$base_url}/static/icon/home.svg" alt="Home" />
</span>
</a>
</span>
</span>