Skip to content

Instantly share code, notes, and snippets.

View jdrydn's full-sized avatar

jdrydn jdrydn

View GitHub Profile
@tdq132
tdq132 / .rclone.conf
Last active May 13, 2019 10:28
systemd service for mounting an rclone remote
[gd-tq]
type = drive
client_id =
client_secret =
scope = drive
root_folder_id =
service_account_file =
token = redacted
[gd-tq-cache]
@g-wilson
g-wilson / lambda.js
Last active September 27, 2017 17:09
Lambda@Edge function for Cloudfront which adds web security headers to static sites hosted with S3 + Cloudfront
/**
* This script is to be deployed as a Lambda@Edge function for AWS Cloudfront which
* adds necessary web security headers to static sites hosted with S3 + Cloudfront.
* This behaviour is not currently (2017-09-27) supported as a configuration option in S3 or Cloudfront.
*
* Lambda trigger event name: "CloudFront Viewer Response"
* Installation instructions: http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/lambda-create-functions.html
*
* Extras not currently included:
*
@nitincoded
nitincoded / xrdp-on-lubuntu-1604.txt
Last active April 24, 2019 14:20
Enable XRDP on Lubuntu 16.04
First open a terminal and enter sudo apt-get install xrdp. When that is installed enter sudo nano /etc/xrdp/startwm.sh in the terminal. Make sure the last line looks like this:
. /etc/X11/Xsession
Then go to your home folder, rightclick and select Show hidden. If there is no file named .xsession, create it. If there is a filed named like that, open it and make sure that it looks like this when your done: lxsession -e LXDE -s Lubuntu
Now type sudo service xrdp restart in the terminal to restart xrdp. Now it should work :)
answered Feb 1 '15 at 9:52
/*
* Flatten Object @gdibble: Inspired by https://gist.github.com/penguinboy/762197
* input: { 'a':{ 'b':{ 'b2':2 }, 'c':{ 'c2':2, 'c3':3 } } }
* output: { 'a.b.b2':2, 'a.c.c2':2, 'a.c.c3':3 }
*/
var flattenObject = function(ob) {
var toReturn = {};
var flatObject;
for (var i in ob) {
if (!ob.hasOwnProperty(i)) {
@magicznyleszek
magicznyleszek / jekyll-and-liquid.md
Last active January 12, 2024 03:46
Jekyll & Liquid Cheatsheet

Jekyll & Liquid Cheatsheet

A list of the most common functionalities in Jekyll (Liquid). You can use Jekyll with GitHub Pages, just make sure you are using the proper version.

Running

Running a local server for testing purposes:

lass KeenHttpOutput < Fluent::Output
Fluent::Plugin.register_output('out-keen-http', self)
def initialize
super
require 'rubygems'
require 'eventmachine'
require 'em-http-request'
require 'cgi'
require 'json'
@tgvashworth
tgvashworth / .gitconfig
Last active December 13, 2022 14:15
.gitconfig & .gitignore
# A ~/.gitconfig file
[user]
name = YOUR NAME
email = YOUR EMAIL
[github]
user = YOUR USERNAME
token = YOUR TOKEN
[core]
quotepath = false
editor = nvim
@SiriusDely
SiriusDely / push_apns.php
Created May 2, 2012 00:23
Push Notification PHP Script - Apple iOS, Android C2DM, BlackBerry PPG
<?php
// Put your device token here (without spaces):
$deviceToken = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
// Put your private key's passphrase here:
$passphrase = 'xxxxxxx';
// Put your alert message here:
$message = 'A push notification has been sent!';
@mathewbyrne
mathewbyrne / slugify.js
Created October 12, 2011 04:34
Javascript Slugify
function slugify(text)
{
return text.toString().toLowerCase()
.replace(/\s+/g, '-') // Replace spaces with -
.replace(/[^\w\-]+/g, '') // Remove all non-word chars
.replace(/\-\-+/g, '-') // Replace multiple - with single -
.replace(/^-+/, '') // Trim - from start of text
.replace(/-+$/, ''); // Trim - from end of text
}
@loonies
loonies / 1_phpunit-api.md
Last active January 19, 2024 07:34
PHPUnit Cheat Sheet

PHPUnit API reference

  • version 3.6

TODO

Check those constraints:

$this-&gt;anything()