Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am jorgejams88 on github.
  • I am jorgemoran (https://keybase.io/jorgemoran) on keybase.
  • I have a public key whose fingerprint is 901E 13AE 65D3 FD86 9F71 E8CF 7C87 E253 B15E 7F76

To claim this, I am signing this object:

@0xjams
0xjams / random_fortune.sh
Created March 29, 2015 23:31
Random fortune with a random format cowsay
#!/bin/bash
formats=$(cowsay -l)
words=$(echo $formats | wc -w)
format=$(($RANDOM%($words-5)))
str_format=$(echo $formats | cut -d" " -f $(($format+5)))
fortune ~/fortunes/facts_complete.dat | cowsay -f $str_format
@0xjams
0xjams / convert_videos_radio_compatible.py
Created June 6, 2015 01:19
Batch convert video files to a format compatible with a Pioneer 5700BHS radio
import glob
import os
files=glob.glob("*.mp4")
for file in files:
outputName=file.replace(".mp4",".avi")
os.system("ffmpeg -i \"%s\" -c:v mpeg4 -q:v 5 -tag:v DIVX -s 640x480 -c:a libmp3lame -q:a 5 -ac 2 -ar 44100 \"%s\"" % (file,outputName))
@0xjams
0xjams / isDesktopBrowser.php
Created June 8, 2015 18:28
Validate if the user agent belongs to a desktop client
function isDesktopBrowser(){
if((strpos(strtolower($_SERVER["HTTP_USER_AGENT"]),"windows")!==false && strpos(strtolower($_SERVER["HTTP_USER_AGENT"]),"windows phone")===false) or (strpos(strtolower($_SERVER["HTTP_USER_AGENT"]),"linux")!==false && strpos(strtolower($_SERVER["HTTP_USER_AGENT"]),"android")===false) or strpos(strtolower($_SERVER["HTTP_USER_AGENT"]),"macintosh")!==false)
{
return true;
}
return false;
}
@0xjams
0xjams / generate_csr.sh
Created June 18, 2015 22:58
Generate a certificate signing request
openssl req -nodes -sha256 -newkey rsa:2048 -keyout domain.com.key -out domain.com.csr
@0xjams
0xjams / phantomjs_screenshots_urls.js
Last active December 2, 2015 17:09
A script to use Phantomjs to get screenshots of an array of urls.
var urls=["https://reddit.com","https://facebook.com"];
var page = require('webpage').create();
page.urls=urls;
console.log("Working with " + page.urls.length + " urls");
page.currentIndex=0;
page.nextScreenshot=function(){
console.log("Getting screenshot of: " + page.urls[page.currentIndex]);
page.open(page.urls[page.currentIndex], function(status) {
console.log("Status: " + status);
if(status === "success") {
@0xjams
0xjams / snippet.nginx.conf
Last active March 12, 2016 18:32
Nginx server configuration for silex
server {
listen 80;
server_name empleo.localhost;
root html/empleo/web;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
try_files $uri /index.php$is_args$args;
@0xjams
0xjams / config.txt
Created March 13, 2016 02:11
Configuration line for compiling nginx and php-fpm
./configure --prefix=/usr/local/nginx --user=nginx --group=nginx --with-http_ssl_module --with-ipv6
'./configure' '--prefix=/usr/local/php' '--enable-inline-optimization' '--disable-debug' '--disable-libgcc' '--disable-libtool-lock' '--disable-cgi' '--enable-safe-mode' '--with-libxml-dir' '--enable-dom' '--enable-libxml' '--with-bz2=shared' '--enable-calendar' '--with-zlib-dir=shared' '--with-ttf' '--with-freetype-dir' '--with-mysql=mysqlnd' '--with-mysql-sock' '--with-zlib-dir' '--enable-sockets' '--enable-zip' '--with-pear' '--enable-session' '--with-zend-vm=CALL' '--enable-mbstring' '--with-regex' '--with-openssl' '--with-expat-dir' '--with-pcre-regex' '--enable-xml' '--enable-ctype' '--enable-json' '--enable-pdo' '--with-curl' '--with-pdo-mysql=mysqlnd' '--with-mysqli=mysqlnd' '--with-gd' '--with-jpeg-dir' '--with-vpx-dir' '--with-xpm-dir=/usr' '--enable-opcache' --enable-fpm
@0xjams
0xjams / disable_voicemail.sh
Created May 10, 2016 23:20
Kill voicemail notification
adb shell am force-stop com.android.phone
adb -d shell pm grant com.nolanlawson.logcat android.permission.READ_LOGS