Skip to content

Instantly share code, notes, and snippets.

View trepidity's full-sized avatar

Jared Jennings trepidity

View GitHub Profile
@renso3x
renso3x / Play.js
Last active September 21, 2017 06:57
import moment from 'moment';
import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
import {
View,
Text,
StyleSheet,
Image,
ImageBackground
} from 'react-native';
//using DotNetOpenAuth and RestSharp
WebServerClient client = new WebServerClient(
new AuthorizationServerDescription
{
TokenEndpoint = new Uri("https://myurl/oauth"),
ProtocolVersion = ProtocolVersion.V20
}, "client", "secret");
var token = client.GetClientAccessToken();
@ishida
ishida / gist:2719962
Created May 17, 2012 16:21
change alias in keystore using keytool
$ keytool -changealias -keystore MY_KEYSTORE_2.jks -alias XXX-XXX-XXX-XXX-XXX -destalias MY_ALIAS
@mixinmax
mixinmax / rsa-encrypt.js
Last active July 24, 2019 02:45
Uses 256-bit AES to encrypt a file which is signed using RSA. The ciphertext, RSA encrypted AES key and the signature are concatenated into a binary file to be used in rsa-decrypt.js
'use strict';
// set up required modules
var fs = require('fs');
var args = require('minimist')(process.argv.slice(2));
// the ursa module is imported to wrap OpenSSL and provide RSA encryption for
// the digital signing aswell as encrypting the symmetric key. URSA cannot do
// symmetric encryption natively, so we need another module for that
var ursa = require('ursa');
@craigmdennis
craigmdennis / spinSubmit.js
Created December 7, 2011 16:02
Add a loading animation to a submit <button> or <a> before submitting a form
/**
Requires:
Spin.js (http://fgnass.github.com/spin.js/)
Spin.js jQuery plugin (https://gist.github.com/1290439)
Usage: $(#your-id).spinSubmit();
For best results, change the 'small' to - small:{lines:12,length:3,width:2,radius:4} in the jQuery plugin
@jareware
jareware / s3-curl-backups.md
Last active August 29, 2021 00:56
Simple, semi-anonymous backups with S3 and curl

⇐ back to the gist-blog at jrw.fi

Simple, semi-anonymous backups with S3 and curl

Backing stuff up is a bit of a hassle, to set up and to maintain. While full-blown backup suites such as duplicity or CrashPlan will do all kinds of clever things for you (and I'd recommend either for more complex setups), sometimes you just want to put that daily database dump somewhere off-site and be done with it. This is what I've done, with an Amazon S3 bucket and curl. Hold onto your hats, there's some Bucket Policy acrobatics ahead.

There's also a tl;dr at the very end if you just want the delicious copy-pasta.

Bucket setup

@nateware
nateware / nginx.conf
Last active November 23, 2021 10:54
Nginx sample config for EC2
#
# Sample nginx.conf optimized for EC2 c1.medium to xlarge instances.
# Also look at the haproxy.conf file for how the backend is balanced.
#
user "nginx" "nginx";
worker_processes 10;
error_log /var/log/nginx_error.log info;
@rtfpessoa
rtfpessoa / java-8-ami.md
Last active March 21, 2022 14:46
[Guide] Install Oracle Java (JDK) 8 on Amazon EC2 Ami
@chsh
chsh / orders_controller_spec.rb
Created April 30, 2013 13:35
RSpec controller example
require 'spec_helper'
# This spec was generated by rspec-rails when you ran the scaffold generator.
# It demonstrates how one might use RSpec to specify the controller code that
# was generated by Rails when you ran the scaffold generator.
#
# It assumes that the implementation code is generated by the rails scaffold
# generator. If you are using any extension libraries to generate different
# controller code, this generated spec may or may not pass.
#
@rstacruz
rstacruz / index.md
Last active November 3, 2023 09:56
Rails models cheatsheet

Rails Models

Generating models

$ rails g model User

Associations

belongs_to

has_one