Skip to content

Instantly share code, notes, and snippets.

@freddie0621
freddie0621 / upload.php
Created September 12, 2020 14:47 — forked from taterbase/upload.php
Simple file upload in php
<!DOCTYPE html>
<html>
<head>
<title>Upload your files</title>
</head>
<body>
<form enctype="multipart/form-data" action="upload.php" method="POST">
<p>Upload your file</p>
<input type="file" name="uploaded_file"></input><br />
<input type="submit" value="Upload"></input>

stackoverflow (hdorio)

Fast answer:

sed ':a;N;$!ba;s/\n/ /g' file
  1. :a create a label 'a'
  2. N append the next line to the pattern space
  3. $! if not the last line, ba branch (go to) label 'a'
  4. s substitute, /\n/ regex for new line, / / by a space, /g global match (as many times as it can)
@freddie0621
freddie0621 / .bash_profile
Created April 9, 2020 23:29 — forked from jonsuh/.bash_profile
Bash echo in color
# ----------------------------------
# Colors
# ----------------------------------
NOCOLOR='\033[0m'
RED='\033[0;31m'
GREEN='\033[0;32m'
ORANGE='\033[0;33m'
BLUE='\033[0;34m'
PURPLE='\033[0;35m'
CYAN='\033[0;36m'
@freddie0621
freddie0621 / mosiac_command.sh
Created January 15, 2020 13:32 — forked from bdero/mosiac_command.sh
ffmpeg 8x8 mosiac video command
#!/bin/bash
ffmpeg -i small/0.mp4 -i small/1.mp4 -i small/10.mp4 -i small/11.mp4 -i small/12.mp4 -i small/13.mp4 -i small/14.mp4 -i small/15.mp4 -i small/16.mp4 -i small/17.mp4 -i small/18.mp4 -i\
small/19.mp4 -i small/2.mp4 -i small/20.mp4 -i small/21.mp4 -i small/22.mp4 -i small/23.mp4 -i small/24.mp4 -i small/25.mp4 -i small/26.mp4 -i small/27.mp4 -i small/28.mp4 -i small/2\
9.mp4 -i small/3.mp4 -i small/30.mp4 -i small/31.mp4 -i small/32.mp4 -i small/33.mp4 -i small/34.mp4 -i small/35.mp4 -i small/36.mp4 -i small/37.mp4 -i small/38.mp4 -i small/39.mp4 -i\
small/4.mp4 -i small/40.mp4 -i small/41.mp4 -i small/42.mp4 -i small/43.mp4 -i small/44.mp4 -i small/45.mp4 -i small/46.mp4 -i small/47.mp4 -i small/48.mp4 -i small/49.mp4 -i small/5\
.mp4 -i small/50.mp4 -i small/51.mp4 -i small/52.mp4 -i small/53.mp4 -i small/54.mp4 -i small/5
@freddie0621
freddie0621 / LICENCE SUBLIME TEXT
Created March 3, 2019 20:15
Sublime Text 3 Serial key build is 3176
## Sublime Text 3 Serial key build is 3176
> * Added these lines into /etc/hosts
127.0.0.1 www.sublimetext.com
127.0.0.1 license.sublimehq.com
> * Used the license key
----- BEGIN LICENSE -----
@freddie0621
freddie0621 / gist:8584d76ecff863aeb6ff57db61e912a2
Created August 11, 2018 22:56 — forked from mattfelsen/gist:9467420
Splitting strings by a delimiter for Arduino
//
// This is tested and works!
//
String input = "123,456";
int firstVal, secondVal;
for (int i = 0; i < input.length(); i++) {
if (input.substring(i, i+1) == ",") {
firstVal = input.substring(0, i).toInt();
secondVal = input.substring(i+1).toInt();
<?php
// In PHP 5.4 you can pass JSON_UNESCAPED_UNICODE and JSON_UNESCAPED_SLASHES to json_encode:
$input = array('file' => '/\intro_cropsic – .m4v');
$paramsString = json_encode($input, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
// And that will encode arrays with unicode characters more compatible with JavaScript.
// (e.g. it will produce the same sha1 if you phpjs.utf8_encode paramString in JavaScript )
// On PHP 5.3 and lower, you may want to try
function json_encode_noescape_slashes_unicode ($arr) {
<?php
// In PHP 5.4 you can pass JSON_UNESCAPED_UNICODE and JSON_UNESCAPED_SLASHES to json_encode:
$input = array('file' => '/\intro_cropsic – .m4v');
$paramsString = json_encode($input, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
// And that will encode arrays with unicode characters more compatible with JavaScript.
// (e.g. it will produce the same sha1 if you phpjs.utf8_encode paramString in JavaScript )
// On PHP 5.3 and lower, you may want to try
function json_encode_noescape_slashes_unicode ($arr) {