Skip to content

Instantly share code, notes, and snippets.

View NicolaeNMV's full-sized avatar

Nicu Namolovan NicolaeNMV

View GitHub Profile
@NicolaeNMV
NicolaeNMV / gist:7329d7921ea6df0c6d55
Created August 20, 2014 15:03
Playframework 2.2.x JDBC logging
Add to application.conf
db.default.logStatements=true
logger.com.jolbox.bonecp=DEBUG
Ref: http://stackoverflow.com/questions/4832056/java-jdbc-how-to-connect-to-oracle-using-service-name-instead-of-sid
/**
* Cache a remote resource with WS and put it into cache with Playframework 2.2.0
*
* Here I'm doing the caching of google images, but you can easily adapt it to your needs
*/
package controllers
import play.api.cache.Cache
import play.api._
@NicolaeNMV
NicolaeNMV / play2_cache_error
Created March 12, 2014 14:00
Play framework cache lib not found error
If you get "object cache is not a member of package play.api" error with play 2, that mean that you don't have the cache lib dependency.
To solve this issue, add:
libraryDependencies += cache
To your build.sbt.
GET /scds/common/u/images/themes/katy/ghosts/person/ghost_person_50x50_v1.png HTTP/1.1
Host: s.c.lnkd.licdn.com
Connection: keep-alive
Cache-Control: no-cache
Accept: image/webp,*/*;q=0.8
Pragma: no-cache
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.107 Safari/537.36
Referer: http://www.linkedin.com/..
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8
@NicolaeNMV
NicolaeNMV / useful_commands.sh
Last active August 29, 2015 13:56
Some very useful commands
# Connect to ssh throughout a socks server at localhost:9150
ssh -o "ProxyCommand /usr/bin/nc -x localhost:9150 %h %p" user@hostname
# Download something and resume. Useful when "Copy cURL" from chrome://inspector
curl -C - -o "some_name"
@NicolaeNMV
NicolaeNMV / sbt_debug_run.sh
Created January 21, 2014 14:49
How to launch a play2 application in debug mode with sbt
# Declare a env. variable with JPDA params
export SBT_OPTS="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=9999 "
sbt run
# You should see: "Listening for transport dt_socket at address: 9999"
# From your IDE, configure Remote Debugging. As described here http://www.playframework.com/documentation/2.2.x/IDE
@NicolaeNMV
NicolaeNMV / pgp_public_key
Created November 26, 2013 13:03
My public PGP key
Now you can verify thats really me who sent something.
-----BEGIN PGP PUBLIC KEY BLOCK-----
mQINBFKUmVwBEAD0R5jfFQBQ/bQBHjAR9l5db4S76sFjxJyelPzMB/Q0GNQYyhVs
Ren/PaYR8g3xOVC60bv2swH3PWZfaAhenlnvVxXmymUnWeuB+TULoxY74xSuEpFa
jKdC2Z+hgXLKBMJZNtOWnnLWuCdpCNr+JhA8vL42fzfK9pXMpxi+UzrS2VGe8/7t
+e+6s2G/FuBLBq1PGAzswsouziZQ+XI4BLCZzz4K0TV5pZQ6fc6l2yMCeiVaOqF8
TOAO3+Zx4qvSCeO1cJcJ8Jh+mCCkhe1aUHMjiiVGew0aBJpxov339zOy325VdZ7K
Y67ozytQxR7qly1yI7SakuQM/SYhviL9KnveHzYyJZTT/d6Glc4pZFEbVKo/fHEj
@NicolaeNMV
NicolaeNMV / filterusableipv4addreses.sh
Created December 23, 2011 16:32
filterusableipv4addreses.sh
#to generate:
#curl http://www.iana.org/assignments/ipv4-address-space/ipv4-address-space.txt | grep "/8" | egrep "LEGACY|ALLOCATED" | sed -e "s/^[ \t]*//g" | cut -f 1 -d " " | awk '{split($0,a,"/");print a[1]".0.0.0/"a[2]}
@NicolaeNMV
NicolaeNMV / alers_http_sms.sh
Created February 8, 2011 12:40
HTTP monitor sms alert
#!/bin/bash
send_time_file="http_alerts_last_fail_sms.txt"
# Details http://prinfum.wordpress.com/2011/02/08/alerte-sms-cind-cade-siteul/
# To edit
cd /home/unde_va_fi_scris_fisierul_Care_Salveaza_Ora
function test {
# To edit
h=`curl --connect-timeout 60 --max-time 60 http://siteulvostru.com | grep "un careva text din html"`
if (( ("$?" != "0") || ("${#h}" == "0") )); then