Skip to content

Instantly share code, notes, and snippets.

Avatar
🤙
Looking for a project to help with/contribute!

Patryk Małek pmalek

🤙
Looking for a project to help with/contribute!
View GitHub Profile
@pmalek
pmalek / count_pages.sh
Created Jan 20, 2014
Bash script to count pages of pdfs in current directory
View count_pages.sh
#!/bin/bash
sum_pages=0
for file in *.pdf ; do
cur_pages=$(pdfinfo $file | awk '/Pages/{print $2}')
echo "pdf: $file has $cur_pages pages."
sum_pages=$(( sum_pages + cur_pages))
done
echo "All pdf files in this directory have $sum_pages pages."
@pmalek
pmalek / show_LBAs_written.sh
Created Jan 24, 2014
Show LBAs, MBs and GBs written to disk
View show_LBAs_written.sh
#!/bin/bash
scale=3
lbas=$(sudo smartctl --all /dev/sda | grep Total_LBAs_Written | awk '{print $(NF)}')
mbs=$(( $lbas / 2048 ))
# gbs=$(( $mbs / 1024.0 ))
gbs=$(bc -l <<< "scale=3 ; $mbs / 1024.0")
echo "LBAs written: $lbas"
@pmalek
pmalek / set_cap.sh
Created Feb 1, 2014
Allow an app to use port below 1024 without root permissions (node.js example)
View set_cap.sh
sudo apt-get install libcap2-bin
sudo setcap cap_net_bind_service=+ep /usr/local/bin/node
View http-proxy_issue.js
var httpProxy = require('http-proxy'),
fs = require('fs');
console.log("proxy");
var options = {
target: "https://localhost",
ssl: {
key: fs.readFileSync('./ssl/key.pem'),
cert: fs.readFileSync('./ssl/cert.pem')
@pmalek
pmalek / fglrx_fix
Created Mar 21, 2014
Fglrx new kernels fix
View fglrx_fix
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,3)
if (!ACPI_SUCCESS(acpi_get_table_with_size(id, 0, &hdr, &tbl_size)))
#else
tbl_size = 0x7fffffff;
if (!ACPI_SUCCESS(acpi_get_table(id, 0, &hdr)))
#endif
{
return KCL_ACPI_ERROR;
}
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,1)
@pmalek
pmalek / android_hide_status_bar.java
Created Apr 23, 2014
Hide status bar in Android
View android_hide_status_bar.java
getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
@pmalek
pmalek / android_hide_title_bar.java
Created Apr 23, 2014
Hide title bar in Android
View android_hide_title_bar.java
requestWindowFeature(Window.FEATURE_NO_TITLE);
View concatenate.sh
gs -q -sPAPERSIZE=letter -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=output.pdf file1.pdf file2.pdf file3.pdf [...] lastfile.pdf
@pmalek
pmalek / add_to_eclipse.ini
Created Sep 10, 2014
Fix eclipse (adt) crashing with libsoup segfault. Add this to eclipse.ini
View add_to_eclipse.ini
-Dorg.eclipse.swt.browser.DefaultType=mozilla
@pmalek
pmalek / README
Last active Aug 29, 2015
ralink mt7601 linux driver patch. Take a look into README
View README
This patch may not necessarily work - this is a better version at launchpad by Victor Martinez https://code.launchpad.net/~victored/+junk/mt7601U-linux-driver-64bit
after:
sudo make install,
do
sudo modprobe mt7601Usta