Skip to content

Instantly share code, notes, and snippets.

View paulschreiber's full-sized avatar

Paul Schreiber paulschreiber

View GitHub Profile
@GaryJones
GaryJones / .jscsrc
Last active November 2, 2018 19:49
JSCS config file
{
"requireSpacesInConditionalExpression": true,
"requireSpacesInFunction": {
"beforeOpeningCurlyBrace": true
},
"disallowSpacesInFunction": {
"beforeOpeningRoundBrace": true
},
"requireMultipleVarDecl": "onevar",
"requireSpacesInsideObjectBrackets": "all",
@omercs
omercs / Oauth2AzureActiveDirectoryRuby
Last active March 2, 2021 12:21
Oauth2 token from Azure Active Directory in Ruby on Rails project
require 'oauth2'
class WelcomeController < ApplicationController
# You need to configure a tenant at Azure Active Directory(AAD) to register web app and web service app
# You will need two entries for these app at the AAD portal
# You will put clientid and clientsecret for your web app here
# ResourceId is the webservice that you registered
# RedirectUri is registered for your web app
CLIENT_ID = 'b6a42...'
CLIENT_SECRET = 'TSbx..'
@bergantine
bergantine / genpass.py
Last active May 18, 2021 07:13
Safari-style #python #password Generator
from random import choice
def genCode(len):
return ''.join([choice('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789') for i in range(len)])
print '%s-%s-%s-%s' % (genCode(3), genCode(3), genCode(3), genCode(3))
@dloman
dloman / xvfb
Last active September 12, 2023 12:32 — forked from jterrace/xvfb
### BEGIN INIT INFO
# Provides: Xvfb
# Required-Start: $local_fs $remote_fs
# Required-Stop:
# X-Start-Before:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Loads X Virtual Frame Buffer
### END INIT INFO
@aras-p
aras-p / preprocessor_fun.h
Last active May 18, 2024 08:55
Things to commit just before leaving your job
// Just before switching jobs:
// Add one of these.
// Preferably into the same commit where you do a large merge.
//
// This started as a tweet with a joke of "C++ pro-tip: #define private public",
// and then it quickly escalated into more and more evil suggestions.
// I've tried to capture interesting suggestions here.
//
// Contributors: @r2d2rigo, @joeldevahl, @msinilo, @_Humus_,
// @YuriyODonnell, @rygorous, @cmuratori, @mike_acton, @grumpygiant,
@nickcatal
nickcatal / disqus.js
Created June 14, 2013 04:32
#NN13 Google Analytics Example Snippets
// Disqus Tracking
/*
Put <div id="disqus_thread"></div> above
*/
var disqus_shortname = 'yourfuckingpollingplace'; // required: replace example with your forum shortname
function track_disqus(comment) {
_gaq.push(['_trackEvent', 'Disqus', 'Comment', document.title]);
};
@willurd
willurd / web-servers.md
Last active May 19, 2024 20:19
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
@thomasgriffin
thomasgriffin / gist:4953041
Created February 14, 2013 14:04
My gift to you this Valentine's Day. Rendering custom attachment fields in the new media manager via Backbone.
/**
* The code below renders additional custom attachment fields into the
* new media manager.
*
* I am assuming you are using your own custom media modal frame. By
* extending the default Attachment.Details subview, we can append our
* custom fields to the default fields listed.
*
* In the initialize function, we ensure that our changes are always up
* to date by "listening" to our model's change event and updating the
@postmodern
postmodern / rails_rce.rb
Last active July 17, 2023 11:54
Proof-of-Concept exploit for Rails Remote Code Execution (CVE-2013-0156)
#!/usr/bin/env ruby
#
# Proof-of-Concept exploit for Rails Remote Code Execution (CVE-2013-0156)
#
# ## Advisory
#
# https://groups.google.com/forum/#!topic/rubyonrails-security/61bkgvnSGTQ/discussion
#
# ## Caveats
#
@loonies
loonies / pubsub.js
Created October 11, 2012 14:23
jQuery pub/sub plugin by Peter Higgins
/*!
* jQuery pub/sub plugin by Peter Higgins
* https://github.com/phiggins42/bloody-jquery-plugins/blob/master/pubsub.js
*
* Modified by Tobin Bradley
*
* AFL/BSD Licensed
*/
;(function(d){
// the topic/subscription hash