Skip to content

Instantly share code, notes, and snippets.

@vrslev
vrslev / main.py
Last active March 11, 2024 09:23
Automatic browser reloading in FastAPI
import os
import arel
from fastapi import FastAPI, Request
from fastapi.templating import Jinja2Templates
app = FastAPI()
templates = Jinja2Templates("templates")
if _debug := os.getenv("DEBUG"):
@P7h
P7h / jdk_download.sh
Last active May 21, 2024 02:10
Script to download JDK / JRE / Java binaries from Oracle website from terminal / shell / command line / command prompt
##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### #####
### Shell script to download Oracle JDK / JRE / Java binaries from Oracle website using terminal / command / shell prompt using wget.
### You can download all the binaries one-shot by just giving the BASE_URL.
### Script might be useful if you need Oracle JDK on Amazon EC2 env.
### Script is updated for every JDK release.
### Features:-
# 1. Resumes a broken / interrupted [previous] download, if any.
# 2. Renames the file to a proper name with including platform info.
@juliangruber
juliangruber / README.md
Last active March 24, 2021 02:00
lightweight node-websocketd

node-websocketd

A lightweight node port of websocketd, originally written in go.

Usage

node-websocketd --port=8080 ./count.sh
@jedi4ever
jedi4ever / nodejs-cluster-zero-downtime.md
Last active February 11, 2024 13:45
nodejs clustering, zero downtime deployment solutions

Clustering: The basics

The trick? pass the file descriptor from a parent process and have the server.listen reuse that descriptor. So multiprocess in their own memory space (but with ENV shared usually)

It does not balance, it leaves it to the kernel.

In the last nodejs > 0.8 there is a cluster module (functional although marked experimental)

window.fluid.dockBadge = '';
setTimeout(updateDockBadge, 1000);
setTimeout(updateDockBadge, 3000);
setInterval(updateDockBadge, 5000);
function updateDockBadge() {
var navigation = document.querySelector('[role=navigation]')
var doc = navigation.contentDocument || navigation.ownerDocument;
$VERBOSE = nil
require File.expand_path('../rooby', __FILE__)
Person = Rooby::Class.new 'Person' do
define :initialize do |name|
@name = name
end
define :name do
@santoshrajan
santoshrajan / sequence.ls
Created September 13, 2012 16:23
A LispyScript example using sequenced callbacks.
;; http://lispyscript.com
;; LispyScript sequenced callback example
;; No need for nested callbacks. Just write your callbacks in a sequence and pass "(next)" as
;; your callback, which will set the next function in the sequence as your callback.
;;
;; This example is a simple node server that will serve static plain text file to the browser.
;;
(var fs (require "fs"))
(var http (require "http"))
@sit
sit / build.gradle
Last active June 24, 2022 11:50
A sample build.gradle for setting up a basic Gradle project for CDH application development
apply plugin: "java"
apply plugin: "eclipse"
apply plugin: "idea"
group = "com.mycompany.hadoopproject"
version = "1.0"
repositories {
// Standard Maven
mavenCentral()
@molily
molily / apps-berlin-js.md
Last active October 7, 2015 19:48
Slides of the apps.berlin.js meetups

The apps.berlin.js meetup

apps.berlin.js is a Berlin.js spin-off with a special focus on JavaScript-driven web applications (“HTML5 apps”), desktop browser apps as well as mobile apps and games written in JavaScript. Here you can find the slides and additional links of all past talks. Please fork this Gist to add more info!

First meetup on May 10th 2012

@smougenot
smougenot / A_Logstash.conf
Created July 26, 2012 13:59
Logstash Multiline Filter for Java Stacktrace (tested on field)
# stacktrace java as one message
multiline {
#type => "all" # no type means for all inputs
pattern => "(^.+Exception: .+)|(^\s+at .+)|(^\s+... \d+ more)|(^\s*Caused by:.+)"
what => "previous"
}