Skip to content

Instantly share code, notes, and snippets.

@jamiephan
jamiephan / README.md
Last active December 29, 2024 06:30
A script to automatically add ALL items to your account in quixel

Script to add all items from quixel

As quixel is being removed, all items are free to aquire. This script is to automate the process to add items to your account (As of writing, a total of 18874 items)

Note: This script only tested in the latest version of Chrome.

How to use

  1. Copy the script from below (run.js)
  2. Login into https://quixel.com
@y0ngb1n
y0ngb1n / docker-registry-mirrors.md
Last active December 29, 2024 06:29
国内的 Docker Hub 镜像加速器,由国内教育机构与各大云服务商提供的镜像加速服务 | Dockerized 实践 https://github.com/y0ngb1n/dockerized
@daif
daif / iban.php
Created February 21, 2019 13:54
Check IBAN number
<?php
/**
* Value should be an IBAN number
*
*
* @param string
* @return bool
*/
function iban($str)
{
@daif
daif / file_cache_contents.php
Created January 4, 2017 16:50
Tiny Cache system
<?php
//Tiny Cache system
function file_cache_contents($url, $cache_time=360000) { // 60*60*5
$cache_dir = __DIR__.'/cache/';
$cache_file = $cache_dir.md5($url).'.cache';
@mkdir($cache_dir, 0775, true);
// return data from cached file if file exists and not expired
if(file_exists($cache_file) && filemtime($cache_file)+$cache_time >= time()) {
return(unserialize(file_get_contents($cache_file)));
}
@CompeyDev
CompeyDev / exec.luau
Last active December 29, 2024 06:27
Builder pattern class to spawn, manage and kill child processes.
--> Builder pattern class to spawn, manage and kill child processes
local process = require("@lune/process")
local task = require("@lune/task")
local option = require("./option")
local Option = option.Option
type Option<T> = option.Option<T>
local CommandBuilder = {}
@daif
daif / file_search.php
Last active December 29, 2024 06:27
search in text file
<?php
// script startup time and memory usage
$mem_usage = memory_get_usage();
$time_usage = microtime(true);
$return = 'FALSE';
$password = '070162';
// get password list file from https://github.com/danielmiessler/SecLists/tree/master/Passwords
/* don't touch the above lines */
/* ------------------------------------------------------------------- */
function divide2(a,b,mid) {
let num = 0;
let middle = mid || a >> 1;
if (middle * b == a) {
return middle;
} else {
if (middle == 1) {
return 0;
}
@daif
daif / imagehash.php
Last active December 29, 2024 06:26
a simple image hashing algorithm
<?php
function imageHash($image_file) {
// check if the file is existed and is readable
if(file_exists($image_file) && is_readable($image_file)) {
return false;
}
// get image dimensions
list($width, $height) = getimagesize($image_file);
<?php
// set your database path
$firebase = 'https://myrealtimedb.firebaseio.com/';
// Update or Save to fireBase
$data = FireBaseJson('PUT','MyContentPath', 'MyContentData');
print_r($data);
// Get from fireBase
$data = FireBaseJson('GET', 'MyContentPath');
@evaera
evaera / Clean Code.md
Last active December 29, 2024 06:16
Best Practices for Clean Code
  1. Use descriptive and obvious names.
    • Don't use abbreviations, use full English words. player is better than plr.
    • Name things as directly as possible. wasCalled is better than hasBeenCalled. notify is better than doNotification.
    • Name booleans as if they are yes or no questions. isFirstRun is better than firstRun.
    • Name functions using verb forms: increment is better than plusOne. unzip is better than filesFromZip.
    • Name event handlers to express when they run. onClick is better than click.
    • Put statements and expressions in positive form.
      • isFlying instead of isNotFlying. late intead of notOnTime.
      • Lead with positive conditionals. Avoid if not something then ... else ... end.
  • If we only care about the inverse of a variable, turn it into a positive name. missingValue instead of not hasValue.