Skip to content

Instantly share code, notes, and snippets.

View jyxjjj's full-sized avatar
🇳🇱

DESMG-ShenLin jyxjjj

🇳🇱
View GitHub Profile
@jyxjjj
jyxjjj / tmooc.py
Last active August 9, 2021 04:08
Tmooc Downloader - To generate TMOOC videos' download links and ffmpeg commands.
#-*- coding: utf-8 -*-
from selenium import webdriver
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.keys import Keys
import re
import time
import os, sys
from urllib import parse
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>Media</title>
<link rel="dns-prefetch" href="https://unpkg.com">
<link rel="preconnect" href="https://unpkg.com">
<link href="https://unpkg.com/bootstrap@3.4.1/dist/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<div>
@jyxjjj
jyxjjj / GET.php
Created October 12, 2022 03:52
cURL PHP GET POST
<?php
function GET($url, $user_agent = 'CURL', $proxy_type = CURLPROXY_SOCKS5_HOSTNAME, $proxy = null, $header = null, $timeout = 10)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_USERAGENT, $user_agent);
$header != null && curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
$proxy != null && curl_setopt($ch, CURLOPT_PROXYTYPE, $proxy_type);
$proxy != null && curl_setopt($ch, CURLOPT_PROXY, $proxy);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
@jyxjjj
jyxjjj / balance.sh
Last active December 9, 2022 05:48
CPU Freq Settings For Intel CPUs On Linux, tested with Intel Core I9-11900K
#!/bin/bash
# min cpu freq to 2.0GHz
echo 2000000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
echo 2000000 > /sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq
echo 2000000 > /sys/devices/system/cpu/cpu2/cpufreq/scaling_min_freq
echo 2000000 > /sys/devices/system/cpu/cpu3/cpufreq/scaling_min_freq
echo 2000000 > /sys/devices/system/cpu/cpu4/cpufreq/scaling_min_freq
echo 2000000 > /sys/devices/system/cpu/cpu5/cpufreq/scaling_min_freq
echo 2000000 > /sys/devices/system/cpu/cpu6/cpufreq/scaling_min_freq
echo 2000000 > /sys/devices/system/cpu/cpu7/cpufreq/scaling_min_freq
@jyxjjj
jyxjjj / smart.js
Created March 22, 2023 08:13
Run smartctl then output the data to http
const http = require('node:http');
const fs = require('node:fs');
const cp = require('node:child_process');
const url = require('node:url');
const allowedDevices = /(sd[a-z]|nvme\d|nvme\dn1|disk\d)/;
const server = http.createServer();
server.on('request', getSmart);
server.listen(7627, '127.0.0.1');
@jyxjjj
jyxjjj / MariaDBError.php
Created September 8, 2023 07:00
Temporary MariaDB Error Codes Enum
<?php
namespace DESMG\MariaDB\V11_0_2;
enum MariaDBError: int
{
/** hashchk */
case ER_HASHCHK = 1000;
/** isamchk */
case ER_NISAMCHK = 1001;
@jyxjjj
jyxjjj / Invoice.rb
Last active October 13, 2023 08:31
"Invoice Ruby Code Template" For PHP "Ruby Code Generator"
# frozen_string_literal: true
require 'prawn'
families = {
'JetBrains Mono NL' => {
bold: { file: "{{ $fontPath }}JetBrainsMonoNL-Bold.ttf" },
bold_italic: { file: "{{ $fontPath }}JetBrainsMonoNL-BoldItalic.ttf" },
extra_bold: { file: "{{ $fontPath }}JetBrainsMonoNL-ExtraBold.ttf" },
extra_bold_italic: { file: "{{ $fontPath }}JetBrainsMonoNL-ExtraBoldItalic.ttf" },
@jyxjjj
jyxjjj / CountryCodeToEmoji.php
Last active March 19, 2024 02:07
ISO-3166-1-Alpha-2 Country Code to Unicode Emoji
<?php
function countryCodeGetEmoji($countryCode = 'XX', $continent = 'XX'): string
{
try {
if (strlen($countryCode) !== 2) {
throw new InvalidArgumentException('Invalid country code');
}
if ($countryCode === 'XX') {
return mb_convert_encoding("&#x1F310;", 'UTF-8', 'HTML-ENTITIES');
}
<?php /** @noinspection PhpComposerExtensionStubsInspection */
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Process;
use SQLite3;
class DecryptChromeCookies extends Command
{
@jyxjjj
jyxjjj / Fix L G Hub App Icon.sh
Created August 8, 2024 02:03
FROM 2024.6.600476
#!/bin/zsh
brew update && brew upgrade imagemagick
iconutil -c iconset --output ~/Downloads/icon.iconset /Applications/lghub.app/Contents/Resources/icon.icns
magick ~/Downloads/icon.iconset/icon_512x512@2x.png -resize 512x512 ~/Downloads/icon.iconset/icon_512x512.png
magick ~/Downloads/icon.iconset/icon_512x512@2x.png -resize 512x512 ~/Downloads/icon.iconset/icon_256x256@2x.png
magick ~/Downloads/icon.iconset/icon_512x512@2x.png -resize 256x256 ~/Downloads/icon.iconset/icon_256x256.png