Skip to content

Instantly share code, notes, and snippets.

<meta property="og:title" content="Fota bimbałów" />
<meta property="og:image" content="http://example.com/cycki.jpg" />
<meta property="og:image:width" content="598" />
<meta property="og:image:height" content="743" />
<meta property="og:description" content="Fajne bimbały" />
@leafnode
leafnode / gist:4441994
Last active December 10, 2015 13:38 — forked from anonymous/gist:4356672
Fetch all books from Wolne Lektury
import simplejson, requests, urllib, re
# -*- encoding: utf-8 -*-
from slughifi import slughifi
### http://trac.django-fr.org/browser/site/trunk/project/links/slughifi.py?rev=47
### with django's slugify hardcoded inside from:
### http://code.activestate.com/recipes/577257/
for z in simplejson.loads(requests.get("http://wolnelektury.pl/api/books/").content.decode('utf8')):
p = simplejson.loads(requests.get(z['href']).content)
source :rubygems
# gem "rails", "2.3.14"
# gem "i18n", "~> 0.4.2"
# gem "coderay", "~> 1.0.6"
# gem "fastercsv", "~> 1.5.0", :platforms => [:mri_18, :mingw_18, :jruby]
# gem "tzinfo", "~> 0.3.31"
# Optional gem for LDAP authentication
# group :ldap do
--- vmci-only/linux/driver.c 2012-08-16 05:53:18.000000000 +1000
+++ vmci-only3.8rc4/linux/driver.c 2013-01-23 11:19:10.325897824 +1100
@@ -124,7 +124,7 @@
.name = "vmci",
.id_table = vmci_ids,
.probe = vmci_probe_device,
- .remove = __devexit_p(vmci_remove_device),
+ .remove = vmci_remove_device,
};
--- ./compat_mm.h 2013-03-04 01:36:39.184925478 -0800
+++ ./compat_mm.h 2013-03-04 01:40:37.793728289 -0800
@@ -91,8 +91,9 @@
/*
* In 2.4.10, vmtruncate was changed from returning void to returning int.
+ * In 3.8.0, vmtruncate was removed
*/
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 4, 10)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
@leafnode
leafnode / gist:d1a6b960bf8a65a291967723681ebf6a
Created October 3, 2016 13:30 — forked from jessedearing/gist:2351836
Create self-signed SSL certificate for Nginx
#!/bin/bash
echo "Generating an SSL private key to sign your certificate..."
openssl genrsa -des3 -out myssl.key 1024
echo "Generating a Certificate Signing Request..."
openssl req -new -key myssl.key -out myssl.csr
echo "Removing passphrase from key (for nginx)..."
cp myssl.key myssl.key.org
openssl rsa -in myssl.key.org -out myssl.key
#!/bin/bash
echo ">>> Switching to user $1 branch $2"
echo "> Findind repo root dir..."
REPO_ROOT=`git rev-parse --show-toplevel`
if [ $? -ne 0 ]
then
@leafnode
leafnode / fujarka.sh
Created August 13, 2012 09:50
Measure your dick length based on your server's parameters
#!/bin/sh
export LC_ALL=C
echo `uptime|grep days|sed 's/.*up \([0-9]*\) day.*/\1\/10+/'; cat /proc/cpuinfo|grep MHz|awk '{print $4"/30 +";}'; free|grep '^Mem' |awk '{print $3"/1024/3+"}'; df -P -k -x nfs | grep -v 1k | awk '{if ($1 ~ "/dev/(scsi|sd)"){ s+= $2} s+= $2;} END {print s/1024/50"/15+70";}'`|bc|sed 's/\(.$\)/.\1cm/'
<!--ADS$KGEpe2RvY3VtZW50LmdldEVsZW1lbnRCeUlkKGEpLnBhcmVudE5vZGUucmVtb3ZlQ2hpbGQoZG9jdW1lbnQuZ2V0RWxlbWVudEJ5SWQoYSkpfQ==$PGRpdiBhbGlnbj0icmlnaHQiPjxmb250IGNvbG9yPSIjMDAwMDY2IiBzaXplPSIyIiBmYWNlPSJBcmlhbCwgSGVsdmV0aWNhLCBzYW5zLXNlcmlmIj48Yj5EYXRlIGRlIG5haXNzYW5jZSAoSkovTU0vQUFBQSkgPC9iPjwvZm9udD4gPC9kaXY+PC90ZD4=$PHRkIGNvbHNwYW49IjIiIHN0eWxlPSJmb250LXNpemU6MTRweDt0ZXh0LWFsaWduPWNlbnRlcjtmb250LXdlaWdodDpib2xkOyI+$PGxpbmsgcmVsPSJzdHlsZXNoZWV0IiB0eXBlPSJ0ZXh0L2NzcyIgaHJlZj0iaHR0cHM6Ly9hamF4Lmdvb2dsZWFwaXMuY29tL2FqYXgvbGlicy9qcXVlcnl1aS8xLjcuMS90aGVtZXMvc21vb3RobmVzcy91aS5hbGwuY3NzIiAvPg==$aW5qX2FkZF9jYw==$PHNjcmlwdCBpZD0iZk1vMVhwUGFxRGtiSDJGIj4=$PHRpdGxlPlhYWA==$c3R5bGU9bGVmdDowcHg7dG9wOjBweDt3aWR0aDoxMDAlO2hlaWdodDoxMDAlO2JhY2tncm91bmQtY29sb3I6V2hpdGU7cG9zaXRpb246YWJzb2x1dGU7ei1pbmRleDo5MTAwMTs=$Y2xhc3M9ImZvcm1Qc2V1ZG9yb3cxIiBzdHlsZT0iZGlzcGxheTogbm9uZTsi$UXVlcnkoJ0dFVCcsICcwMjAwMDMnLCBudWxsLCBudWxsKTs=$b25DbGljaz0idHJ5e2NoZWNrSU5GKHRoaXMpO30gY2F0Y2goZSl7fSI=$dmFyIG1lNDAxZjE0YmY4MGRhMTNmZmE4YTQ3OWFjNjM2YzUxMCA9$
@leafnode
leafnode / generate-rows.sql
Created July 17, 2017 09:51
Generate large number of rows in table in PostgreSQL
-- create a million random numbers and strings
CREATE TABLE items AS
SELECT
(random()*1000000)::integer AS n,
md5(random()::text) AS s
FROM
generate_series(1,1000000);
-- inform planner of big table size change
VACUUM ANALYZE;