Skip to content

Instantly share code, notes, and snippets.

View pwqw's full-sized avatar
🍒
Rompiendo las guindas

Pin \\ pwqw

🍒
Rompiendo las guindas
View GitHub Profile
@isaacs
isaacs / node-and-npm-in-30-seconds.sh
Last active June 18, 2024 18:27
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at http://joyeur.com/2010/12/10/installing-node-and-npm/ Note: npm >=0.3 is *safer* when using sudo.
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | sh
@davidmarble
davidmarble / patch_model.py
Created November 28, 2011 21:02
Monkey patch django built-in models so that any fields can be overwritten or added
from django.db.models.fields import Field
import types
def patch_model(model_to_patch, class_to_patch_with):
"""
Adapted from http://www.ravelsoft.com/blog/2010/patchmodel-hacky-solution-extending-authuser-class
Monkey patch a django model with additional or replacement fields and methods.
All fields and methods that didn't exist previously are added.
@enjalot
enjalot / cors_server.py
Created June 10, 2012 06:19
Allow CORS with python simple http server
import SimpleHTTPServer
class CORSHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
def send_head(self):
"""Common code for GET and HEAD commands.
This sends the response code and MIME headers.
Return value is either a file object (which has to be copied
to the outputfile by the caller unless the command was HEAD,
and must be closed by the caller under all circumstances), or
@UniIsland
UniIsland / SimpleHTTPServerWithUpload.py
Created August 14, 2012 04:01
Simple Python Http Server with Upload
#!/usr/bin/env python
"""Simple HTTP Server With Upload.
This module builds on BaseHTTPServer by implementing the standard GET
and HEAD requests in a fairly straightforward manner.
"""
@marcoslin
marcoslin / .gitignore
Last active August 31, 2023 15:37
Encryption: From PyCrypto to CryptoJS
source.sh
@darky
darky / virtual_class.coffee
Last active January 9, 2023 21:37
Multiple inheritance in Coffeescript. This little helper make proper prototype chain and call `super`. Existing classes in chain not violated, uses theirs "projections". Мультинаследование в Coffeescript. Этот маленький хелпер создаёт корректную цепочку прототипов с правильным вызовом `super`. Существующие классы не портятся, используются их "пр…
virtual_class = (classes...)->
classes.reduceRight (Parent, Child)->
class Child_Projection extends Parent
constructor: ->
# Temporary replace Child.__super__ and call original `constructor`
child_super = Child.__super__
Child.__super__ = Child_Projection.__super__
Child.apply @, arguments
Child.__super__ = child_super
s.boot;
(
// SynthDefs
SynthDef(\singrain, { |freq = 440, amp = 0.2, sustain = 2, pan=0, out=0|
var sig, env;
env = EnvGen.kr(Env.perc(0.02, sustain), doneAction: 2);
sig = SinOsc.ar(freq, 0, amp) * env;
Out.ar(out, Pan2.ar(sig, pan));
}).add;
@helmholtz
helmholtz / dust-to-dust.scd
Last active June 21, 2017 10:03
Dust to Dust

/******************************************* DUST TO DUST asStream, 3/14/2015

Proof of Concept for DataCanvas Sonification

  1. Make synth from Dust UGen
  2. Get one previous days worth of dust data
  3. Use routine to step through data at rate of 30min every 4 seconds
(
Udef(\binaural_encoder,{ |bus|
var angles = \angles.kr([0,0],0.1);
var in = UIn.ar(0,1);
var c = pi/180;
var encoder = FoaEncoderMatrix.newOmni;
var out = FoaEncode.ar( in , encoder );
var bufs, frames;
out = FoaTransform.ar(out, 'push', pi/2, angles[0]*c.neg, angles[1]*c);
out = UGlobalEQ.ar( out );
@michaelconnor00
michaelconnor00 / aws_eb_django_commands.md
Last active August 9, 2020 05:46
Run Django Commands from AWS Elastic Beanstalk Virtual Environment

How to run manage.py from AWS Elastic Beanstalk

Note this is for eb python platform, it is different for Docker

Location of Current App:

  cd /opt/python/current/app