Skip to content

Instantly share code, notes, and snippets.

@dedg3
dedg3 / gist:8c155574134355ff78c27ef4b4a1cce4
Created January 24, 2019 20:40 — forked from mikesprague/gist:5881937
AWS: Bucket Policy Example (Allow Get by Referer)
{
"Version": "2008-10-17",
"Id": "http referer policy example",
"Statement": [
{
"Sid": "Allow get requests from certain domains (including local development)",
"Effect": "Allow",
"Principal": "*",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::bucket-name-here/*",
@dedg3
dedg3 / elasticsearch-example.js
Created September 23, 2018 21:33 — forked from StephanHoyer/elasticsearch-example.js
Simple example how to use elastic search with node.js
'use strict';
var elasticsearch = require('elasticsearch');
var Promise = require('bluebird');
var log = console.log.bind(console);
var client = new elasticsearch.Client({
host: 'localhost:9200',
log: 'trace'
// C# FizzBuzz Test
using System;
class FizzBuzz {
static void Main() {
for (int n = 1; n <= 100; n ++) {
if (n % 15 == 0) {
Console.WriteLine("FizzBuzz");
}
else if (n % 3 == 0) {
console.log( self.innerWidth );
/* Reset Textskalierung */
body {
-webkit-text-size-adjust: 100%;
}
/* Reset für Inputelemente */
input {
-webkit-appearance: none;
-webkit-border-radius: 0;
/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user
#! /usr/bin/env php
<?php
/* PHP Slowloris
* Adapted from the script found here: http://seclists.org/fulldisclosure/2009/Jun/207
* Contains get based attack (slow headers) and post based attack (long content length)
*
* Author: Seppe vanden Broucke
*/
function usage($argv){
@dedg3
dedg3 / sleep.js
Created January 10, 2013 14:23
Javscript Sleep Function
function sleep(milliseconds) {
var start = new Date().getTime();
for (var i = 0; i < 1e7; i++) {
if ((new Date().getTime() - start) > milliseconds){
break;
}
}
}
// Usage
@dedg3
dedg3 / attr_objFilter.js
Created January 10, 2013 14:22
Filter Objects by data attribute value
/*
<div id="proto_1" data-state="open">Div 1 - proto open</div>
<div id="">Div 2</div>
<div id="proto_3" data-state="closed">Div 3 - proto closed</div>
<div id="proto_4" data-state="open">Div 4 - proto open</div>
*/
var $el = $('div[id^=proto_]').filter('div[data-state=open]').css('color','red');
@dedg3
dedg3 / ipad_dragAndTouchSupport.js
Created January 10, 2013 14:20
Add Drag and Touch Support for iPad
$.fn.addTouch = function(){
this.each(function(i,el){
$(el).bind('touchstart touchmove touchend touchcancel',function(){
//we pass the original event object because the jQuery event
//object is normalized to w3c specs and does not provide the TouchList
handleTouch(event);
});
});
var handleTouch = function(event)