Top Poster
#1 ramon fincken 385
#2 Site admin 3
#3 Ber|Art 2
#4 braddmark 1
#5 accentmedia 1
#6 Xarzu 1
#7 pEcosespedex 1
#8 khadish 1
#9 moxxx 1
#10 nistelrock 1

The time now is Fri Jun 23, 2017 11:56 am
Ramonfincken.com Forum Index
View unanswered posts
[solution] laravel commandline auto yes seed artisan migrate
Author ramon fincken :: Posted: Sat May 13, 2017 8:26 am :: Category: PHP coding


use expect to answer "yes" to all questions, handy if you script your deploys remotely

Code:
!/usr/bin/expect -f
set timeout -1
spawn php artisan migrate:refresh --seed
match_max 1000000
expect "*you really*" { send "yes\r" }
expect "*you really*" { send "yes\r" }
expect "*you really*" { send "yes\r" }
expect "*you really*" { send "yes\r" }
expect eof


call

Code:
expect yourscript.sh


Htaccess rewrite whole site but keep lets encrypt well-known out of rewrite
Author ramon fincken :: Posted: Thu Mar 23, 2017 2:46 pm :: Category: PHP coding


Code:
RewriteEngine on

RewriteBase /
RewriteRule ^(.well-known)($|/) - [L]
RewriteRule ^(.*)$ https://www.newdomain.nl/$1 [R=301,L]


This will rewrite all files and paths except for the SSL verification virtual folder .well-known to the new domain


Git copy repo but only for specific folder, keeping history
Author ramon fincken :: Posted: Fri Mar 03, 2017 1:45 pm :: Category: PHP coding


Code:
cd /git/first/clone
git subtree split --prefix=mydirectory/ --branch=mybranch2


go to your new directory outside your current git directory

Code:
cd /git/second
git init
git pull /git/first/clone namesgen


Now add to master and push to remote origin (git@github.com:joesixpack/namesgen.git)
Code:
git remote add origin git@github.com:joesixpack/namesgen.git
git push -u origin --all


Tested with git version 2.7.4
Code:
git --version
git version 2.7.4


Source: https://ariya.io/2014/07/extracting-par...he-history


[solution] Too many authentication failures for .. port .. ssh
Author ramon fincken :: Posted: Wed Jan 25, 2017 9:17 am :: Category: Bash, perl, python and CLI linux
Tagged: , , ,


You just might have too much pubkeys, use this to connect without a key (for every key is sent and counts as faillure .. )

Code:
ssh -o PubkeyAuthentication=no user@server


Finding spam in HTML source email
Author ramon fincken :: Posted: Sun Dec 04, 2016 1:50 pm :: Category: Bash, perl, python and CLI linux


Note the redirect of this image:

Code:
ramon@devbak01:~$ curl -v http://farms.fplqb.us/Zyyrxyhbb/bejqhq300ezqbcj/.jpg
*   Trying 104.244.210.126...
* Connected to farms.fplqb.us (104.244.210.126) port 80 (#0)
> GET /Zyyrxyhbb/bejqhq300ezqbcj/.jpg HTTP/1.1
> Host: farms.fplqb.us
> User-Agent: curl/7.47.0
> Accept: */*
>
< HTTP/1.1 301 Moved Permanently
< Server: nginx/1.10.2
< Date: Sun, 04 Dec 2016 13:06:29 GMT
< Content-Type: text/html
< Transfer-Encoding: chunked
< Connection: keep-alive
< X-Powered-By: PHP/5.3.3
< Location: http://i.imgsafe.org/0a1f9c334b.jpg
<
* Connection #0 to host farms.fplqb.us left intact


So if you want to set your spamassasin rule to deny the message, search for a subset of farms.fplqb.us and/or the "/.jpg" 'extension' ..


Zip all authorized_keys
Author ramon fincken :: Posted: Tue Nov 15, 2016 1:02 pm :: Category: Bash, perl, python and CLI linux
Tagged:


Need new disks and want to preverve the keys?

Code:
find . -maxdepth X -type f -name 'authorized_keys' | egrep "(authorized_keys)$" | zip -@ X.zip


Amazon Lambda add expires headers to S3 storage uploads automatically
Author ramon fincken :: Posted: Sat Nov 12, 2016 12:46 pm :: Category: Bash, perl, python and CLI linux


Handy if you are using cloudfront, which is unable (sadly) to add extra headers based on S3 source files.

Runtime
Node.js 4.3

Handler
index.handler

Rest is up to you

Memory
128MB

Timeout
5 sec

VPC
No

Triggers
No -> I have set this up in the bucket config -> Events -> add notification for "Object created"


Code
Code:
'use strict';
 
// CONFIGURATION //////////////////////////////////////////////
var CacheControlHeader = 'public, max-age=31536000';
var lineBreak = 'nn-----------------------------------------nn';
///////////////////////////////////////////////////////////////
 
console.log('Loading function...');
 
let aws = require('aws-sdk');
let s3 = new aws.S3({ apiVersion: '2006-03-01' });
 
exports.handler = (event, context, callback) => {
    const bucket = event.Records[0].s3.bucket.name;
    const key = decodeURIComponent(event.Records[0].s3.object.key.replace(/\+/g, " "));
    var params = { Bucket: bucket, Key: key };
    s3.getObject(params, (err, data) => {
        if (err) {
            console.log(err);
            var message = lineBreak+'Error encountered!nnFailed to get object: s3://'+bucket+'/'+key +'.nnMake sure it is in the same region as this function!'+lineBreak;
            console.log(message);
        } else {
        const mimeHeader = data.ContentType;
            if (data.CacheControl != CacheControlHeader) {
                var params = { Bucket: bucket, Key: key, CopySource: encodeURIComponent(bucket+'/'+key), ContentType: data.ContentType, CacheControl: CacheControlHeader, 'Metadata':{}, MetadataDirective: 'REPLACE' };
                s3.copyObject(params, (err, data) => {
                    if (err) {
                        console.log(err);
                        message = lineBreak+'Error encountered!nnFailed to get object: s3://'+bucket+'/'+key +'.nnMake sure it is in the same region as this function!'+lineBreak;
                        console.log(message);
                    } else {
                       message = lineBreak+'Metadata updated successfully!nnOBJECT: s3://'+bucket+'/'+key+'nCONTENT-TYPE: '+mimeHeader+'nCACHE-CONTROL: '+CacheControlHeader+''+lineBreak;
                       console.log(message);
                    }
                });
            } else {
                message = lineBreak+'Metadata already updated!nnOBJECT: s3://'+bucket+'/'+key+'nCONTENT-TYPE: '+mimeHeader+'nCACHE-CONTROL: '+CacheControlHeader+''+lineBreak;
                console.log(message);
            }
 
        }
    });
};


Varnish cron auto flush homepage
Author ramon fincken :: Posted: Tue Nov 08, 2016 10:34 am :: Category: Bash, perl, python and CLI linux


Cron delete (flush) the homepage ( path = / ) of www.DOMAIN.EXT every 5 minutes:

Code:
*/5 * * * * root varnishadm "ban req.http.host ~ www.DOMAIN.EXT && req.url ~ \"^/$\"" >/dev/null 2>&1


All times are GMT
Who is Online
Who is Online Our users have posted a total of 391 articles
We have 26 registered users
The newest registered user is MathewCow
In total there is 1 user online :: 0 Registered, 0 Hidden and 1 Guest   [ Administrator ]   [ Moderator ]
Most users ever online was 41 on Wed Sep 09, 2015 1:34 am
Registered Users: None
This data is based on users active over the past five minutes
Log in
Username:    Password:      Log me on automatically each visit    

New posts New posts    No new posts No new posts    Forum is locked Forum is locked
General forums
The world of freelance
Programming
Other projects
Poll
I love gifts

Yes goodies and presents! [3]
No but I love polls ! [1]

Related google ads