Skip to content

Instantly share code, notes, and snippets.

@pilatuspc12ng
pilatuspc12ng / crypt.py
Last active December 21, 2022 11:51 — forked from ricardojba/crypt.py
Decrypt Laravel-encrypted value
import base64
import json
from phpserialize import loads
import hashlib
import hmac
from Crypto.Cipher import AES
def decrypt(payload, key):
"""
Decrypt strings that have been encrypted using Laravel's encrypter (AES-256 encryption).
@averagehuman
averagehuman / postgres-docker-config.sh
Last active April 3, 2019 22:36
Run postgres on docker host, connect from docker containers
#!/bin/bash
################################################################################
# Rather than run postgres in its own container, we want to run it on
# the (Ubuntu) host and allow:
#
# + peer connections on the host
# + local md5 connections from any docker container
#
# THIS IS COPY/PASTED FROM COMMAND LINE INPUT AND IS UNTESTED AS A SINGLE SCRIPT
################################################################################
@soheilhy
soheilhy / nginxproxy.md
Last active March 22, 2024 08:54
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

@japerk
japerk / nltk_tokenize_tag_chunk.rst
Created February 25, 2012 16:36
NLTK Tokenization, Tagging, Chunking, Treebank

Sentence Tokenization

>>> from nltk import tokenize >>> para = "Hello. My name is Jacob. Today you'll be learning NLTK." >>> sents = tokenize.sent_tokenize(para) >>> sents ['Hello.', 'My name is Jacob.', "Today you'll be learning NLTK."]

@peterbraden
peterbraden / Local ISO String for Date
Created December 23, 2010 00:40
toISOString with timezone support
Date.prototype.toLocalISOString = function(){
// ISO 8601
var d = this
, pad = function (n){return n<10 ? '0'+n : n}
, tz = d.getTimezoneOffset() //mins
, tzs = (tz>0?"-":"+") + pad(parseInt(tz/60))
if (tz%60 != 0)
tzs += pad(tz%60)