Skip to content

Instantly share code, notes, and snippets.

View mkurz's full-sized avatar
💭
Play Roadmap: https://github.com/orgs/playframework/projects/3

Matthias Kurz mkurz

💭
Play Roadmap: https://github.com/orgs/playframework/projects/3
  • Vienna, Austria
  • 08:04 (UTC +02:00)
View GitHub Profile
@willurd
willurd / web-servers.md
Last active April 28, 2024 21:38
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@nakamuray
nakamuray / nautilus-disable-recursive-search.patch
Created July 4, 2013 08:52
I don't want nautilus to search directory recursively.
--- nautilus-3.8.2/libnautilus-private/nautilus-search-directory.c.orig 2013-07-04 17:39:05.893879085 +0900
+++ nautilus-3.8.2/libnautilus-private/nautilus-search-directory.c 2013-07-04 17:39:12.226879030 +0900
@@ -171,7 +171,7 @@
nautilus_search_engine_model_set_model (model_provider, search->details->base_model);
simple_provider = nautilus_search_engine_get_simple_provider (search->details->engine);
- g_object_set (simple_provider, "recursive", TRUE, NULL);
+ g_object_set (simple_provider, "recursive", FALSE, NULL);
reset_file_list (search);
@plentz
plentz / nginx.conf
Last active April 24, 2024 11:15
Best nginx configuration for improved security(and performance)
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@philfreo
philfreo / gist:7257723
Created October 31, 2013 21:44
Facebook Perl source code from 2005. When browsing around thefacebook.com in 2005 the server spit out some server-side source code rather than running it. I believe this was for their old graph feature that let you visualize the graph between all your friends. The filename is `mygraph.svgz` and contains some gems such as a commented out "zuck" d…
#!/usr/bin/perl
use Mysql;
use strict;
use vars qw($school_name);
use vars qw($pass);
require "./cgi-lib.pl";
@subudeepak
subudeepak / WebSockets.md
Last active November 2, 2022 00:04
The problems and some security implications of websockets - Cross-site WebSockets Scripting (XSWS)

WebSockets - An Introduction

WebSockets is a modern HTML5 standard which makes communication between client and server a lot more simpler than ever. We are all familiar with the technology of sockets. Sockets have been fundamental to network communication for a long time but usually the communication over the browser has been restricted. The general restrictions

  • The server used to have a permanent listener while the client (aka browser) was not designated any fixed listener for a more long term connection. Hence, every communication was restricted to the client demanding and the server responding.
  • This meant that unless the client requested for a particular resource, the server was unable to push such a resource to the client.
  • This was detrimental since the client is then forced to check with the server at regular intervals. This meant a lot of libraries focused on optimizing asynchronous calls and identifying the response of asynchronous calls. Notably t
@Kartones
Kartones / postgres-cheatsheet.md
Last active April 30, 2024 19:47
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
chrome.webRequest.onHeadersReceived.addListener(
function (details) {
for (var i = 0; i < details.responseHeaders.length; ++i) {
if (details.responseHeaders[i].name.toLowerCase() == 'x-frame-options') {
details.responseHeaders.splice(i, 1);
return {
responseHeaders: details.responseHeaders
};
}
}
@rafi
rafi / install.sh
Created July 3, 2014 12:49
setup msmtp and php
apt-get install msmtp ca-certificates
vim /etc/msmtprc
# Set defaults.
defaults
# Enable or disable TLS/SSL encryption.
tls on
tls_starttls on
tls_trust_file /etc/ssl/certs/ca-certificates.crt
@adriaanm
adriaanm / sam_streams.scala
Last active November 8, 2020 01:28
Playing with Java 8 Stream from Scala 2.11.5
// $ scala-2.11.5 -Xexperimental
// Original Java 8 version: http://winterbe.com/posts/2014/07/31/java8-stream-tutorial-examples/
scala> import java.util.{Arrays, List, ArrayList}
scala> import java.util.stream.{Stream, IntStream}
// List<String> myList = Arrays.asList("a1", "a2", "b1", "c2", "c1");
scala> val myList = Arrays.asList("a1", "a2", "b1", "c2", "c1")
@vr100
vr100 / gist:81b37e89e9688d2ad02d
Created December 5, 2014 12:38
String and timestamp support in evolutions for play framework
/**
* Read evolution files from the application environment.
*/
@Singleton
class EvolutionsReader @Inject() (environment: Environment) {
/**
* Read the application evolutions.
*
* @param db the database name