Showing posts with label PHP. Show all posts
Showing posts with label PHP. Show all posts

Thursday, September 21, 2017

Extract Audio from Video with FFmpeg and Format Factory

FFmpeg:

FFmpeg is a free software project that produces libraries and programs for handling multimedia data.



Format Factory:

FormatFactory is an ad-supported freeware multimedia converter that can convert video, audio, and picture files. It is also capable of ripping DVDs and CDs to other file formats, as well as creating .iso images. It can also join multiple video files together into one.



How to extract audio from video using FFmpeg:

If you just want to copy the audio stream without re-encoding just do:

ffmpeg -i input-video.avi -vn -acodec copy output-audio.aac

-vn is no video.
-acodec copy says use the same audio stream that's already in there.

Read the output to see what codec it is, to set the right filename extension.

Sunday, September 10, 2017

Build Jenkins Job Remotely | Fix: Error 403 No valid crumb was included in the request


In case you are a newbie with Jenkins read through this article: http://com.puter.tips/2017/09/getting-up-and-running-with-jenkins.html



Build Jenkins Job Remotely

I have found two ways in which you can trigger a build on job remotely via scripting.

Both methods are simple HTTP Get/Post requests, nothing fancy here. Along with these Requests we need to pass login credentials.

Method 0: No protection enabled

=> This is the case when you are in a secure environment and have disabled all additional protection mechanism like CSRF (Method 1) and Authentication Token (Method 2). If this is the case then you can simply trigger a HTTP Request like this:

'http://username:password@jenkins_url:port/job/job_name/build'

e.g. http://admin:pass@localhost:8080/job/job1/build

Jenkins: Trigger build remotely via script using Authentication Token

Powershell:

$acctname = "admin"
$password = "password"
$server = "localhost"
$port = "8080"
$jobName = "test02"
$jobToken = "test02_authentication_token"
$params = @{uri = "http://${server}:${port}/job/${jobName}/build?token=${jobToken}";
            Method = 'Get';
            Headers = @{Authorization = 'Basic ' + [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes("$(${acctname}):$(${password})"));}}
Invoke-RestMethod @params

Jenkins: Trigger build remotely via script using crumb

Python:

import requests
api_proto = 'http'
api_url = 'localhost'
api_port = '8080'
api_job = 'test01'
api_user = 'admin'
api_pass = 'password'

api_crumb = requests.get(api_proto + '://' + api_user + ':' + api_pass + '@' + api_url + ':' + api_port + '/crumbIssuer/api/json')
if api_crumb.status_code == 200 :
    api_crumb = api_crumb.json()['crumb']

resp = requests.post(api_proto + '://' + api_url + ':' + api_port + '/job/' + api_job + '/build', auth=(api_user, api_pass), headers={"Jenkins-Crumb":api_crumb})
if resp.status_code == 201:
    print(api_job + ' was triggered successfuly..')

Saturday, July 16, 2016

Learn C and C++

C and C++:

The major difference between C and C++ is that C is a procedural programming language and does not support classes and objects, while C++ is a combination of both procedural and object oriented programming language; therefore C++ can be called a hybrid language.

C:

C was developed by Dennis Ritchie between 1969 and 1973 at AT&T Bell Labs. When compared to C++, C is a subset of C++. C supports procedural programming paradigm for code development. In C (because it is a procedural programming language), data and functions are separate and free entities.

Full (MEAN) Stack Developer Tutorials

Full Stack Development:

The term full-stack means developers who are comfortable working with both back-end and front-end technologies. To be more specific, it means that the developer can work with databases, PHP, HTML, CSS, JavaScript and everything in between, also, venturing as far as converting Photoshop designs to front-end code. (Ref.: https://www.sitepoint.com/full-stack-developer/)


MEAN Stack:

MEAN is a framework for an easy starting point with MongoDB, Node.js, Express, and AngularJS based applications. It is designed to give you a quick and organized way to start developing MEAN based web apps with useful modules like Mongoose and Passport pre-bundled and configured. We mainly try to take care of the connection points between existing popular frameworks and solve common integration problems. (Ref.: http://learn.mean.io/)


Online Certification Courses (MOOCs) and Tutorials:
  1. https://www.udacity.com/course/full-stack-web-developer-nanodegree--nd004
  2. https://www.coursera.org/specializations/full-stack
  3. https://www.edx.org/course/introduction-mongodb-using-mean-stack-mongodbx-m101x-0
  4. https://mva.microsoft.com/en-us/training-courses/mean-stack-jump-start-8442?l=eovSb3Vz_4604984382
  5. http://www.ibm.com/developerworks/library/wa-mean1/index.html
  6. https://www.codeschool.com/mean
  7. https://www.udemy.com/courses/search/?q=mean%20stack&src=ukw&lang=en 

Tuesday, January 12, 2016

Compare two files with PSPad

You can go to http://www.pspad.com/en/download.php and download PSPad text editor.

To get the difference between two text files open PSPad editor. Then go to Tools menu and select Text Differences then select first option that is Text Diff with This File...

Saturday, March 07, 2015

Fix update/upgrade errors in Kali Linux

[This is post is for older release. If you are looking for fixing errors in Rolling Release (2016.1) go to this link: http://com.puter.tips/2016/08/fix-updateupgrade-errors-in-kali-linux.html]

If you are among the users who are getting errors while updating or upgrading in Kali Linux then your worries are over. I had the same issue and have found a solution.

The errors occurs when performing any of the following commands:
#apt-get update
#apt-get upgrade
#apt-get dist-upgrade

and even if you try --fix-missing parameter with above commands it does not help!

One of the error looks like:
W: A error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: http://security.kali.org kali/updates Release: The following signatures were invalid: KEYEXPIRED 1425567400 KEYEXPIRED 1425567400 KEYEXPIRED 1425567400

Sunday, February 01, 2015

Encryption using OpenSSL

OpenSSL is an open source toolkit for implementing secure sockets layer (SSL) and transport layer security (TLS) protocol. It provides various cryptographic functions. Latest version is 1.0.2 released on 22nd January 2015. Visit the official website: https://www.openssl.org/

If you have already installed any VPN or Web server then you will find openssl over there.

VPN: C:\Program Files\CyberGhost 5\Data\OpenVPN\openssl.exe
PHP: C:\xampp\php\extras\openssl\openssl.exe
Apache: C:\xampp\apache\bin\openssl.exe
MinGW: C:\MinGW\msys\1.0\bin\openssl.exe

And if you don't then go to https://www.openssl.org/related/binaries.html to download executable file.