Skip to content

Instantly share code, notes, and snippets.

View wereHamster's full-sized avatar
🌍
Lower Your Eyelids To Die With The Sun

Tomáš Čarnecký wereHamster

🌍
Lower Your Eyelids To Die With The Sun
View GitHub Profile
@wereHamster
wereHamster / README.md
Created January 9, 2011 20:57
Script to upload files to github.
@wereHamster
wereHamster / README.md
Last active June 21, 2020 19:57 — forked from yorkxin/README.md
Proxy to remote server with CORS support

cors.py for mitmproxy

Hacking CORS restriction to enable in-browser XHR to any server.

Usage

Say you are running an web app at localhost, and you want to send XHR to http://remote-server:80, but the CORS restriction forbids access because you are sending requests from an origin that remote-server:80 does not allow.

Run:

@wereHamster
wereHamster / machine.js
Created August 19, 2019 07:30
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
Aurum GNC
Boot
ok -> Welcome
emergency stop -> Emergency Stop
some event -> Workout
Welcome
Mode Selection
Workout
Exercise
index.js
index.d.ts
example.js
example.d.ts
node_modules/
@wereHamster
wereHamster / gist:869686
Created March 14, 2011 19:16
mongoose behavior of pre/post-init middleware
var mongoose = require('../lib/mongoose')
mongoose.connect('mongodb://localhost/test');
var Document = null, DocumentSchema = new mongoose.Schema({
data: { type: String },
});
DocumentSchema.pre('init', function(next) {
console.log('pre-init: ' + JSON.stringify(this));
{
"name": "playground",
"version": "0.0.0",
"description": "",
"main": "server.js",
"dependencies": {
"connect": "~2.11.0",
"connect-compiler": "~0.1.3",
"less": "~1.5.1",
"livereload": "~0.3.2"
require 'mail'
class Jekyll::Post
alias :to_liquid_without_comments :to_liquid
def to_liquid
data = to_liquid_without_comments
data['comments'] = Comments::load(self)
@wereHamster
wereHamster / genpass.js
Created July 13, 2013 08:12
Generate a random password from as many keys as there are on a standard US layout keyboard.
#!/usr/bin/env node
var chars =
[ 'abcdefghijklmnopqrstuvwxyz'
, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
, '1234567890'
, '~!@#$%^&*()_a+'
, '`-='
, '[]{}o\'O",./<>?'
].join();