Skip to content

Instantly share code, notes, and snippets.

View saltukalakus's full-sized avatar
💭

Saltuk Alakus saltukalakus

💭
View GitHub Profile
@rdegges
rdegges / quickstart.js
Last active August 29, 2015 14:01
Stormpath Node.js Quickstart
/*
* quickstart.js
* ~~~~~~~~~~~~~
*
* Code from the Stormpath Node.js Quickstart:
* http://docs.stormpath.com/nodejs/quickstart/
*
* You can run this code by typing:
*
* $ node quickstart.js
@gfrey
gfrey / gist:8472007
Created January 17, 2014 11:34
Upstart script for haproxy with support for reload.
description "Properly handle haproxy"
start on startup
env PID_PATH=/var/run/haproxy.pid
env BIN_PATH=/usr/sbin/haproxy
script
exec /bin/bash <<EOF
$BIN_PATH -f /etc/haproxy.cfg -D -p $PID_PATH
# HAProxy config for hoodie + ssl.
# Uses nginx for file serving on 127.0.0.1:5999
# This is optional, Hoodie can serve static files fine.
global
log 127.0.0.1 local0 debug
maxconn 4096
user haproxy
group haproxy
daemon
@yuvadm
yuvadm / fabfile.py
Created March 16, 2011 13:41
Fabric example for SSH keyfile connection
from fabric.api import *
env.hosts = ['host.name.com']
env.user = 'user'
env.key_filename = '/path/to/keyfile.pem'
def local_uname():
local('uname -a')
def remote_uname():
@serverwentdown
serverwentdown / server.js
Last active January 29, 2019 20:18 — forked from mixonic/server.js
// Bug fixes for current versions.
//
// This server will start a bash shell and expose it
// over socket.io to a browser. See ./term.html for the
// client side.
//
// You should probably:
//
// npm install socket.io
@onedesign
onedesign / mongodb-upstart.sh
Created January 4, 2011 21:29
Ubuntu upstart script for MongoDB with automatic repair
# Ubuntu upstart file at /etc/init/mongodb.conf
pre-start script
mkdir -p /var/lib/mongodb/
mkdir -p /var/log/mongodb/
end script
start on runlevel [2345]
stop on runlevel [06]
async function getTokenFromRulesConfig(user, context, callback) {
const m2mClientID = configuration.m2mCID;
const m2mClientSecret = configuration.m2mCSecret;
let auth0Domain = '<<your_tenant>>.auth0.com';
const moment = require('moment-timezone');
let axios = require('axios');
const country = context.request.geoip.country_name;
const data = {
user_app_metadata: user.app_metadata,
email: user.email,
@saltukalakus
saltukalakus / handler.js
Created September 7, 2020 14:19 — forked from marc-barry/handler.js
Cloudflare Worker for Auth0 Self-Managed Certificates
addEventListener('fetch', event => {
event.respondWith(handleRequest(event.request))
})
async function handleRequest(request) {
const url = new URL(request.url)
url.hostname = 'SOME_HOSTNAME' // i.e. 'dev-w-47n-vy-cd-e88kLg26GFbLGgBI.edge.tenants.auth0.com'
request = new Request(request)
request.headers.set('cname-api-key', 'SOME_KEY') // i.e. 'd4f2f3ef5a3ee3af4846127281d3450628bdc16d63e802dea75878fe9a63a279'
@geoff-parsons
geoff-parsons / live-update-chartjs.html
Created June 1, 2013 05:36
Example of live updating Chart.js charts.
<!DOCTYPE html>
<html>
<head>
<title>Chart.js Redraw Example</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.0/jquery.min.js"></script>
<script type="text/javascript" charset="utf-8" src="chart.min.js"></script>
<script type="text/javascript" charset="utf-8">
window.chartOptions = {
segmentShowStroke: false,
@karmi
karmi / .gitignore
Created November 27, 2010 16:26
`tail -f` in Node.js and WebSockets
.DS_Store
*.log
tmp/