Skip to content

Instantly share code, notes, and snippets.

View lesstif's full-sized avatar

KwangSeob Jeong lesstif

View GitHub Profile
@lesstif
lesstif / change-ubuntu-mirror.sh
Last active March 20, 2024 07:03
우분투(ubuntu)의 apt 기본 미러(mirror)를 다음 카카오(kakao), 카이스트(kaist), 부경대(harukasan) 으로 변경
#!/usr/bin/env bash
SL=/etc/apt/sources.list
PARAM="r:hm:dnak"
KAKAO=mirror.kakao.com
KAIST=ftp.kaist.ac.kr
HARU=ftp.harukasan.org
@lesstif
lesstif / HMacTest.java
Last active February 27, 2024 07:10
HMAC SHA256 example java code
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
public class HMacTest {
public static final String ALGORITHM = "HmacSHA256";
public static String calculateHMac(String key, String data) throws Exception {
Mac sha256_HMAC = Mac.getInstance(ALGORITHM);
@lesstif
lesstif / curl-get.php
Last active January 19, 2024 11:20
PHP CURL POST example
<?php
$url = 'http://google.com';
if ($argc > 1){
$url = $argv[1];
}
$ch=curl_init();
// user credencial
@lesstif
lesstif / generate_large_file.php
Created March 4, 2015 02:05
Quickly generate large text file with random string content.
#!/usr/bin/env php
<?php
## http://stackoverflow.com/questions/4356289/php-random-string-generator
function generateRandomString($length = 10)
{
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
$charactersLength = strlen($characters);
$randomString = '';
@lesstif
lesstif / change-centos-mirror.sh
Last active December 7, 2023 15:25
change centos mirror to korea's portal.(CentOS 를 카카오와 네이버로 변경)
#!/usr/bin/env bash
BASE_REPOS=/etc/yum.repos.d/CentOS-Linux-BaseOS.repo
PARAM="r:hkn"
KAKAO="mirror.kakao.com\/centos"
NAVER="mirror.navercorp.com\/centos"
if [ "$(id -u)" != "0" ]; then
echo "'$0' must be run as root" 1>&2
@lesstif
lesstif / nginx-with-tls13-compile.sh
Last active November 23, 2023 16:39
openssl 1.1 & nginx compile script for TLS 1.3 support on RHEL/CentOS 7
#!/bin/bash
## nginx
NGINX=nginx-1.19.4.tar.gz
if [ ! -f "${NGINX}" ];then
wget https://nginx.org/download/${NGINX}
fi
ND=$(basename $NGINX .tar.gz)
@lesstif
lesstif / winget-package-install.ps1
Last active November 3, 2023 02:32
windows package install using winget package manager
## copy from https://gist.github.com/cdekkerpossibilit/d023602c29fdf039c7eabadf64f708e9
function Confirm-Choice {
param (
[string]$Message
)
$yes = new-Object System.Management.Automation.Host.ChoiceDescription "&Yes","Yes";
$no = new-Object System.Management.Automation.Host.ChoiceDescription "&No","No";
$choices = [System.Management.Automation.Host.ChoiceDescription[]]($yes, $no);
$answer = $host.ui.PromptForChoice("", $message, $choices, 1)
@lesstif
lesstif / phpstan.neon.dist
Last active October 4, 2023 12:58
phpstan.neon.dist for laravel
includes:
- ./vendor/nunomaduro/larastan/extension.neon
parameters:
paths:
- app
# The level 8 is the highest level
level: 5
@lesstif
lesstif / aws-ami2-ec2-redis-cli.md
Created June 12, 2019 10:33
install redis-cli on AWS AMI2 without redis server
#!/bin/bash
sudo yum install gcc -y
wget http://download.redis.io/redis-stable.tar.gz
tar xvzf redis-stable.tar.gz
cd redis-stable
make MALLOC=libc
@lesstif
lesstif / settings.json
Last active September 15, 2023 08:48
windows terminal settings json file for wsl2, wsl(Windows Subsystem For Linux)
// This file was initially generated by Windows Terminal 0.11.1191.0
// It should still be usable in newer versions, but newer versions might have additional
// settings, help text, or changes that you will not see unless you clear this file
// and let us generate a new one for you.
// To view the default settings, hold "alt" while clicking on the "Settings" button.
// For documentation on these settings, see: https://aka.ms/terminal-documentation
{
"$schema": "https://aka.ms/terminal-profiles-schema",