Skip to content

Instantly share code, notes, and snippets.

View vthorsell's full-sized avatar

Victor Thorsell vthorsell

View GitHub Profile
@lmj0011
lmj0011 / rejson-for-ubuntu.md
Last active November 4, 2024 10:18
Building and Loading the ReJSON v1 Module on Linux Ubuntu 16.04 for Redis

make sure you have at least redis v4.0+

redis-server --version

redis-cli --version

install the build-essential package

apt-get install build-essential

@uorat
uorat / nginx-websocket-proxy.conf
Last active September 26, 2024 15:57
Nginx Reverse Proxy for WebSocket
upstream websocket {
server localhost:3000;
}
server {
listen 80;
server_name localhost;
access_log /var/log/nginx/websocket.access.log main;
@hollodotme
hollodotme / Install-php7.md
Last active August 11, 2022 06:23
Installing php7-fpm with phpredis and xdebug extension on Ubuntu 14.04

Install php7.0-fpm

# remove php5 modules
apt-get autoremove --purge php5-*
# add php-7.0 source list by [Ondřej Surý](https://github.com/oerdnj)
add-apt-repository ppa:ondrej/php
# Update index
apt-get update
# Install php7.0-fpm with needed extensions
@ygotthilf
ygotthilf / jwtRS256.sh
Last active March 26, 2025 01:10
How to generate JWT RS256 key
ssh-keygen -t rsa -b 4096 -m PEM -f jwtRS256.key
# Don't add passphrase
openssl rsa -in jwtRS256.key -pubout -outform PEM -out jwtRS256.key.pub
cat jwtRS256.key
cat jwtRS256.key.pub
@vin-ai
vin-ai / Yii-MailGun.php
Last active April 27, 2017 22:53
PHP Class for Yii PHP Framework to Send E-mails using Curl. It's uses MailGun API to send emails.
<?php
/**
* MailGun PHP Curl Client
*
* @version 1.1b
* @copyright &copy; 2015, VINAY KUMAR SHARMA <[email protected]>
* @author VINAY KUMAR SHARMA
*/
class MailGun extends CApplicationComponent {
@stojg
stojg / Cache_Stamped_example.php
Created July 20, 2014 11:21
Cache Stampede example
<?php
/**
* Cache stampede protection examples
*/
class cache
{
/**
* @var array
#!/usr/bin/ruby
# Create display override file to force Mac OS X to use RGB mode for Display
# see http://embdev.net/topic/284710
require 'base64'
data=`ioreg -l -d0 -w 0 -r -c AppleDisplay`
edids=data.scan(/IODisplayEDID.*?<([a-z0-9]+)>/i).flatten
vendorids=data.scan(/DisplayVendorID.*?([0-9]+)/i).flatten
@jonashansen229
jonashansen229 / class.database.php
Last active June 20, 2023 08:41
PHP OOP Database class using MySQLI and Singleton pattern. Only one instance of the class will be made, this requires less memory.
<?php
/*
* Mysql database class - only one connection alowed
*/
class Database {
private $_connection;
private static $_instance; //The single instance
private $_host = "HOSTt";
private $_username = "USERNAME";
private $_password = "PASSWORd";
@kgriffs
kgriffs / sysctl.conf
Last active March 21, 2025 04:08
Linux Web Server Kernel Tuning
# Configuration file for runtime kernel parameters.
# See sysctl.conf(5) for more information.
# See also http://www.nateware.com/linux-network-tuning-for-2013.html for
# an explanation about some of these parameters, and instructions for
# a few other tweaks outside this file.
#
# See also: https://gist.github.com/kgriffs/4027835
#
# Assumes a beefy machine with lots of network bandwidth
@ShirtlessKirk
ShirtlessKirk / luhn.js
Last active January 6, 2025 16:01
Luhn validation algorithm
/**
* Luhn algorithm in JavaScript: validate credit card number supplied as string of numbers
* @author ShirtlessKirk. Copyright (c) 2012.
* @license WTFPL (http://www.wtfpl.net/txt/copying)
*/
var luhnChk = (function (arr) {
return function (ccNum) {
var
len = ccNum.length,
bit = 1,