Skip to content

Instantly share code, notes, and snippets.

View jyhsu2000's full-sized avatar

KID jyhsu2000

View GitHub Profile
@komen205
komen205 / gist:c1374b96eb0158a96d682995f79157b4
Created September 3, 2022 11:47 — forked from pazdera/gist:1121315
Brute-force string generation in Python (optimized for printable characters only)
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Brute-force string generation
# Copyright (C) 2011 Radek Pazdera
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
@nunenuh
nunenuh / generate_random_color_image.py
Last active May 27, 2022 10:59
Generate Random Uniform Colored Image with OpenCV
import random
import numpy as np
import matplotlib.pyplot as plt
from tqdm import tqdm, trange
from pathlib import Path
import cv2 as cv
def random_color_image(size=(600,800)):
r = int(np.random.uniform(0,255))
g = int(np.random.uniform(0,255))
/*
1) Open https://popcat.click
2) Open console (F12)
3) Insert code & run
*/
var event = new KeyboardEvent('keydown', {
key: 'g',
ctrlKey: true
@Magnum97
Magnum97 / SimpleConfig.java
Last active March 9, 2024 16:02
Config manager for Bukkit / Spigot Minecraft plugins. Allows easy & attractive header, comments add & preserve on change and automatically updated the config with resource file if key does not exist.
/*
* Base with comment and header features created by Log-out
* https://bukkit.org/threads/tut-custom-yaml-configurations-with-comments.142592/
* Updated by Magnum1997 to auto update config files from resources
*/
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.plugin.java.JavaPlugin;
@bessarabov
bessarabov / gist:674ea13c77fc8128f24b5e3f53b7f094
Last active March 27, 2024 07:46
One-liner to generate data shown in post 'At what time of day does famous programmers work?' — https://ivan.bessarabov.com/blog/famous-programmers-work-time
git log --author="Linus Torvalds" --date=iso | perl -nalE 'if (/^Date:\s+[\d-]{10}\s(\d{2})/) { say $1+0 }' | sort | uniq -c|perl -MList::Util=max -nalE '$h{$F[1]} = $F[0]; }{ $m = max values %h; foreach (0..23) { $h{$_} = 0 if not exists $h{$_} } foreach (sort {$a <=> $b } keys %h) { say sprintf "%02d - %4d %s", $_, $h{$_}, "*"x ($h{$_} / $m * 50); }'
@calebporzio
calebporzio / error_blade_directive.php
Created March 28, 2019 20:34
A little Blade directive to make working with validation errors a bit nicer.
<?php
// Usage:
// Before
@if ($errors->has('email'))
<span>{{ $errors->first('email') }}</span>
@endif
// After:
@HoweChen
HoweChen / opencv_from_base64.py
Last active March 19, 2024 20:20
[opencv_from_base64]read image from opencv with base64 encoding #OpenCV
import cv2
import numpy as np
import base64
image = "" # raw data with base64 encoding
decoded_data = base64.b64decode(image)
np_data = np.fromstring(decoded_data,np.uint8)
img = cv2.imdecode(np_data,cv2.IMREAD_UNCHANGED)
cv2.imshow("test", img)
cv2.waitKey(0)
@LexManos
LexManos / clean.txt
Created December 8, 2018 20:06
1.13 Announcement.
So about 1.13. As we have been stating since the public release of 1.13,
the Forge update is a time we are taking to re-write everything from the
ground up. Not just Forge, but the entire toolchain, launcher, installer,
and core of Forge is being rewritten. Every line of code is being inspected,
and re-validated. This whole process takes a while. To give you (the reader)
an idea of what has been done so far:
ForgeGradle has been rewritten to support modern gradle versions, with better tools
to be expandable and used for more than just setting up a Minecraft/Forge
dependency project. It's also much cleaner and organized this time around
@tuanpht
tuanpht / php-artisan-bash-completion.md
Last active June 7, 2023 07:42 — forked from jhoff/README.md
Bash-only Laravel Artisan tab auto-complete

If you are an Oh-my-zsh user, see the Laravel 5 plugin

For the rest of us Bash users, all of the Laravel Artisan autocomplete solutions out there require installing a composer package to get a list of artisan commands. Turns out this isn't really necessary. Simply add the provided code in ~/.bash_profile ( or similarly sourced file ) and you'll get artisan command tab completes on any project on your system.

_artisan()
{
    local arg="${COMP_LINE#php }"

    case "$arg" in
@domnikl
domnikl / build.gradle.kts
Last active April 12, 2024 22:34
Gradle Kotlin DSL: set main class attribute for jar
tasks.withType<Jar> {
manifest {
attributes["Main-Class"] = "com.example.MainKt"
}
}