Skip to content

Instantly share code, notes, and snippets.

@wsgzao
wsgzao / rps.sh
Last active May 8, 2024 02:39
rps.sh
#!/bin/bash
# chkconfig: 2345 90 60
### BEGIN INIT INFO
# Provides: rps
# Required-Start: $local_fs $remote_fs $network $syslog
# Required-Stop: $local_fs $remote_fs $network $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: enable rps config for ubuntu
# Description: enabele rps which is a kernel tweak for network performance
@camnwalter
camnwalter / hypixel-api-key.md
Last active May 8, 2024 02:35
API Keys After Hypixel's Changes

How to get a new API key after the Hypixel API changes

This key will last forever, and should be for personal use only. Providing a proxy like this to the public is strictly against Hypixel's API Policies.


  1. Go to the Hypixel Developer Dashboard, and log in using your forums account.
  2. Click "Create Development Key" to enable the "Create App" button in the top right.
  3. Create a new app. For this guide, we will make a personal app. Click the Personal API Key button, and fill out the form.
  • For the link field in the application, I just submitted my Cloudflare Workers URL generated in the next section of this guide. Just make sure the link is related to your project in some way.
  1. Once you submit the form, the key should be accepted shortly, just refresh the dashboard. Make sure to copy the api key Hypixel provides you for this application
@rambabusaravanan
rambabusaravanan / detect-js-framework.js
Last active May 8, 2024 02:33
Detect JS Framework used in a Website
// Paste these lines into website's console (Win/Linux: Ctrl + Shift + I / Mac: Cmd + Alt + I)
if(!!window.React ||
!!document.querySelector('[data-reactroot], [data-reactid]') ||
Array.from(document.querySelectorAll('*')).some(e => e._reactRootContainer !== undefined || Object.keys(e).some(k => k.startsWith('__reactContainer')))
)
console.log('React.js');
if(!!document.querySelector('script[id=__NEXT_DATA__]'))
console.log('Next.js');
@o0-o
o0-o / arch-install.sh
Last active May 8, 2024 02:32
Install Arch Linux on MD/LUKS/LVM (Including /boot) + AppArmor or SELinux + Stock AwesomeWM
#!/usr/bin/env zsh
# WARNING: THIS SCRIPT WILL AGGRESSIVELY DESTROY ALL DATA ON ALL DRIVES
# ON THIS SYSTEM!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
#
# This script assumes 3 drives (sda sdb and sdc) are present and the
# first 2 are identical in size. The majority of the operating system
# is installed onto a mirror of sda and sdb. Home is installed on sdc.
########################################################################
declare adm_user='o0-o'
@wojteklu
wojteklu / clean_code.md
Last active May 8, 2024 02:31
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@KristofferEriksson
KristofferEriksson / useKeypress.ts
Last active May 8, 2024 02:31
A React custom hook for handling keyboard events.
import { useEffect } from "react";
const Keys = {
Backspace: "Backspace",
Tab: "Tab",
Enter: "Enter",
Shift: "Shift",
Control: "Control",
Alt: "Alt",
Pause: "Pause",
@ffittschen
ffittschen / gitconfig.md
Last active May 8, 2024 02:29
Use IntelliJ or WebStorm as git mergetool with SourceTree

Use IntelliJ or WebStorm as git mergetool

Configure Sourcetree

The merge tool that ships with JetBrain's IntelliJ IDEA or WebStorm is really awesome and way better than FileMerge. It is quite simple to configure SourceTree to use it as the default mergetool:

  1. Open the SourceTree preferences and select the Diff tab
  2. Choose Custom both as Visual Diff Tool and as Merge Tool
  3. Paste the following commands into the textfields:
  • Diff Command: /Applications/IntelliJ\ IDEA.app/Contents/MacOS/idea diff
@wzjoriv
wzjoriv / clustering.py
Last active May 8, 2024 02:28
Nearest Neighbor, K Nearest Neighbor and K Means (NN, KNN, KMeans) implemented only using PyTorch
import torch as th
"""
Author: Josue N Rivera (github.com/wzjoriv)
Date: 7/3/2021
Description: Snippet of various clustering implementations only using PyTorch
Full project repository: https://github.com/wzjoriv/Lign (A graph deep learning framework that works alongside PyTorch)
"""
def random_sample(tensor, k):
@11658
11658 / BitAPI.py
Last active May 8, 2024 02:22
python对接比特
"""
@Author: 小样
@Date: 2022-10-30
@wechat: mz-cyx
@description: 比特浏览器API接口
@version: 1.0
@AD: 专业定制外网自动化程序TwitterFacebookTiktok等等
##所有定义的接口
#1. 浏览器接口