Skip to content

Instantly share code, notes, and snippets.

View fliiiix's full-sized avatar
🎩
This is the year of ipv6 and python3!

Felix fliiiix

🎩
This is the year of ipv6 and python3!
View GitHub Profile
#[derive(Debug)]
struct Attribute<'a> {
name: &'a str,
url: &'a str,
}
fn main() {
let attributes = vec![
Attribute {
name: "Batman",
@soheilhy
soheilhy / nginxproxy.md
Last active March 17, 2024 11:11
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers

@fdelbos
fdelbos / FreeBSD_node_monit.md
Last active February 17, 2020 13:38
FreeBSD 10 Nodejs setup with nginx, mongo and monit

FreeBSD 10 Nodejs setup with nginx, mongodb, redis and monit

This my receipe for installing a complete nodejs server on FreeBSD 10. The parameters used in this configuration are for a very small private server that I use for demo purpose only, so for a production server, you should somehow set the limits in pair with your ressources.

I use monit so I don't have to write rc scripts for node and it should take care of process lifecycle management for me. Alternatives exists such as supervisord or circus.

Installing mongodb

@optikfluffel
optikfluffel / kitty.zsh
Created February 2, 2014 18:40
zsh function to download an image from placekitten.com
kitty() { command wget -O kitty.jpg http://placekitten.com/"$2"/"$3" }
@stephsharp
stephsharp / README.md
Last active October 22, 2020 00:36
Stack Overflow user profile Dashing widget

Badge Overflow

An exceptionally handsome way to track your Stack Overflow badges.
Note: Badge Overflow now works with all Stack Exchange sites.

Created by Adam & Stephanie Sharp.

User Profile widget

A Dashing widget that

Heh
Anyway
Obviously it's not a huge deal
It just makes me sad
I like Node
And I can write Node
I just don't use it for anything
I like JS
And I can write JS
I just prefer CoffeeScript for day to day use
@runlevel5
runlevel5 / puma.sh
Last active July 18, 2022 17:37
pumactl is very broken, @nemshilov and @joneslee85 wrote this bash script replacement and it works so reliably on production server. So here it is, share with the world!
#!/usr/bin/env bash
# Simple move this file into your Rails `script` folder. Also make sure you `chmod +x puma.sh`.
# Please modify the CONSTANT variables to fit your configurations.
# The script will start with config set by $PUMA_CONFIG_FILE by default
PUMA_CONFIG_FILE=config/puma.rb
PUMA_PID_FILE=tmp/pids/puma.pid
PUMA_SOCKET=tmp/sockets/puma.sock
@spikegrobstein
spikegrobstein / nginx.conf
Last active September 22, 2023 04:19
nginx config for proxying requests for plex over a hostname-based virtualhost.
upstream plex-upstream {
# change plex-server.example.com:32400 to the hostname:port of your plex server.
# this can be "localhost:32400", for instance, if Plex is running on the same server as nginx.
server plex-server.example.com:32400;
}
server {
listen 80;
# server names for this server.
@jbtule
jbtule / AESGCM.cs
Last active October 30, 2023 21:14
I have two code examples that I wrote for best practices encrypting a string in c#. They are both using authenticated encryption. http://stackoverflow.com/a/10366194/637783
/*
* This work (Modern Encryption of a String C#, by James Tuley),
* identified by James Tuley, is free of known copyright restrictions.
* https://gist.github.com/4336842
* http://creativecommons.org/publicdomain/mark/1.0/
*/
using System;
using System.IO;
using System.Text;
@troelskn
troelskn / app.rb
Last active August 12, 2021 17:25 — forked from dstrelau/app.rb
Gollum protected by HTTP Basic
require 'gollum/frontend/app'
require 'digest/sha1'
class App < Precious::App
User = Struct.new(:name, :email, :password_hash, :can_write)
before { authenticate! }
before /^\/(edit|create|delete|livepreview|revert)/ do authorize_write! ; end
helpers do