Skip to content

Instantly share code, notes, and snippets.

# First, install all of the things
sudo su
apt-get update
apt-get install nginx
/etc/init.d/nginx start
apt-get install python-dev
apt-get install python-pip
apt-get install libjpeg-dev libpng-dev libtiff-dev libjasper-dev libgtk2.0-dev python-numpy python-pycurl libwebp-dev python-opencv libjpeg-progs
ln -s /usr/lib/x86_64-linux-gnu/libjpeg.so /usr/lib
@lilactown
lilactown / promises.re
Last active August 20, 2022 07:56
Notes on using JavaScript Promises in ReasonML/BuckleScript
/**
* Making promises
*/
let okPromise = Js.Promise.make((~resolve, ~reject as _) => [@bs] resolve("ok"));
/* Simpler promise creation for static values */
Js.Promise.resolve("easy");
Js.Promise.reject(Invalid_argument("too easy"));
@santoshachari
santoshachari / nginx.default.conf
Last active February 22, 2022 22:11 — forked from sumardi/nginx.default.conf
PHP5.6 and NGINX: Install PHP56-FPM, Nginx & MySQL on EC2 with Amazon Linux AMI
# Install linux update, followed by GCC and Make
sudo yum -y update
sudo yum install -y gcc make
# Install Nginx and php56-FPM
sudo yum install -y nginx php56-fpm
# Install php56 extensions
sudo yum install -y php56-devel php-mysql php56-pdo php56-pear php56-mbstring php56-cli php56-odbc php56-imap php56-gd php56-xml php56-soap
// HOWTO: load LABjs itself dynamically!
// inline this code in your page to load LABjs itself dynamically, if you're so inclined.
(function (global, oDOC, handler) {
var head = oDOC.head || oDOC.getElementsByTagName("head");
function LABjsLoaded() {
// do cool stuff with $LAB here
}
@delikat
delikat / next.config.js
Last active August 4, 2021 03:39
Modular antd imports with next.js, next-less, next-typescript, and babel-plugin-import
const withLess = require('@zeit/next-less')
const withTypescript = require('@zeit/next-typescript')
const resolve = require('resolve')
module.exports = withTypescript(withLess({
lessLoaderOptions: {
javascriptEnabled: true,
// theme antd here
modifyVars: {'@primary-color': '#1Dd57A'}
@amscotti
amscotti / md5.coffee
Last active January 18, 2021 12:54
MD5 hashing
crypto = require('crypto');
#Quick MD5 of text
text = "MD5 this text!"
md5hash1 = crypto.createHash('md5').update(text).digest("hex")
#MD5 of text with updates
m = crypto.createHash('md5')
m.update("MD5 ")
m.update("this ")
package ws.eiennohito.utils.serialization
import java.lang.reflect.Modifier
import java.util.concurrent.ConcurrentHashMap
import akka.serialization.Serializer
import com.google.protobuf.CodedOutputStream
import com.trueaccord.scalapb.{GeneratedMessage, GeneratedMessageCompanion}
import com.typesafe.scalalogging.StrictLogging
@magicspon
magicspon / server.js
Created November 7, 2018 09:48
using https with next
const https = require('https')
const { parse } = require('url')
const next = require('next')
const fs = require('fs')
const dev = process.env.NODE_ENV !== 'production'
const app = next({ dev })
const handle = app.getRequestHandler()
const options = {
@nyango
nyango / WildcardAllowedCORSFilterFactory.scala
Last active December 24, 2019 06:37
Play CORS Filter with wildcard origin matching
import javax.inject.{Inject, Singleton}
import akka.stream.Materializer
import play.api.Configuration
import play.filters.cors.CORSConfig.Origins.Matching
import play.filters.cors.{CORSConfig, CORSFilter}
import scala.concurrent.ExecutionContext
import scala.util.matching.Regex
@ryanttb
ryanttb / install_node_lsw.sh
Last active December 4, 2019 14:28
Install node on Linux Subsystem for Windows
#!/bin/sh
# this script requires root
# be sure to run the following before running this:
# $ sudo su
# since there's an issue piping the curl response to bash
# just download the install script
curl -sL https://deb.nodesource.com/setup_6.x > install_node.sh