Skip to content

Instantly share code, notes, and snippets.

View hugo53's full-sized avatar
🏆
On new thing

Hoang Nguyen hugo53

🏆
On new thing
View GitHub Profile
@mgezkaya
mgezkaya / User.java
Created February 18, 2019 11:59
Cassandra Forward Paging With Spring 2.x
public PagedData findUsersByActivationStatusWithPaging(UserActivationStatus activationStatus, String pagingState) {
logger.info("Finding users by activation status {}...", activationStatus);
Select select = QueryBuilder
.select()
.from("user");
select.where(eq("activationStatus", activationStatus.name()));
select.setFetchSize(pagingFetchSize);
if (pagingState != null) {
select.setPagingState(PagingState.fromString(pagingState));
@fernandoaleman
fernandoaleman / install-rabbitmq-centos-7.md
Last active October 13, 2024 13:37
Install RabbitMQ on CentOS 7

Install RabbitMQ on CentOS 7

sudo yum -y install epel-release
sudo yum -y update

Install Erlang

Download repository

@sparrc
sparrc / install-ffmpeg.sh
Last active November 14, 2023 13:24
Installs ffmpeg with libaom and libx265 enabled for av1 and hevc encoding (tested on Ubuntu 16.04)
#!/usr/bin/env bash
# Installs ffmpeg from source (HEAD) with libaom and libx265, as well as a few
# other common libraries
# binary will be at ~/bin/ffmpeg
sudo apt update && sudo apt upgrade -y
mkdir -p ~/ffmpeg_sources ~/bin
export PATH="$HOME/bin:$PATH"
@fethica
fethica / fetchContentLength.swift
Created January 31, 2018 18:27
[Swift] Get the size (ContentLength) of an http remote file
func fetchContentLength(for url: URL, completionHandler: @escaping (_ contentLength: UInt64?) -> ()) {
var request = URLRequest(url: url)
request.httpMethod = "HEAD"
let task = URLSession.shared.dataTask(with: request) { (data, response, error) in
guard error == nil,
let response = response as? HTTPURLResponse,
let contentLength = response.allHeaderFields["Content-Length"] as? String else {
completionHandler(nil)
@grantjenks
grantjenks / bottlebench.py
Last active October 28, 2021 18:00
Server-side I/O Performance in Python
"""Server-side I/O Performance in Python
Based on the article and discussion at:
https://www.toptal.com/back-end/server-side-io-performance-node-php-java-go
The code was posted at:
https://peabody.io/post/server-env-benchmarks/
@sega-yarkin
sega-yarkin / haproxy-eventmq.cfg
Created September 29, 2017 14:10
HAProxy configuration for RabbitMQ (as STOMP over WS)
###
# HAProxy configuration for Eventmq Web-node.
# Configured to serve:
# - 100k websocket connections
# - 2k (2% of WS) streaming connections (5k fullconn)
# - 100 (0.1% of WS) xhr connections (5k fullconn)
###
global
log 127.0.0.1 local2 info
@jofftiquez
jofftiquez / firebase-admin-multi-apps-init-ES6.md
Last active March 12, 2024 01:29
Firebase admin - how to initialise multiple applications in ES6 nodejs.

Firebase Admin Multi App Initialization - ES6

This is a snippet that uses firebase's firebase-admin to initialize multiple firebase projects in one admin application.

ES5 version

Using ES6

import 'firebase';
@Unitech
Unitech / app-koa.js
Last active January 20, 2022 11:24
Node.js Load Balancers Benchmark: HAProxy vs Nginx vs PM2
const Koa = require('koa');
const app = new Koa();
app.use(ctx => {
ctx.body = 'Hello World';
});
var listener = app.listen(process.env.PORT || 3000, () => {
console.log(`Listening on port ${listener.address().port}`);
});
@Unitech
Unitech / cat proc-cpuinfo
Last active April 11, 2019 09:44
Benchmark PM2 vs HAPROXY vs NGINX - Simple HTTP Node.js application
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 61
model name : Intel(R) Core(TM) i5-5200U CPU @ 2.20GHz
stepping : 4
microcode : 0x23
cpu MHz : 2457.468
cache size : 3072 KB
@nickkraakman
nickkraakman / ffmpeg-cheatsheet.md
Last active November 14, 2024 03:32
FFmpeg cheat sheet for 360 video

FFmpeg Cheat Sheet for 360º video

Brought to you by Headjack

 
FFmpeg is one of the most powerful tools for video transcoding and manipulation, but it's fairly complex and confusing to use. That's why I decided to create this cheat sheet which shows some of the most often used commands.

 
Let's start with some basics:

  • ffmpeg calls the FFmpeg application in the command line window, could also be the full path to the FFmpeg binary or .exe file