Skip to content

Instantly share code, notes, and snippets.

View thulasi-ram's full-sized avatar

Thulasi Ram thulasi-ram

View GitHub Profile
@didip
didip / supervisord-example.conf
Created January 30, 2011 05:10
Example configuration file for supervisord.conf
[unix_http_server]
file=/tmp/supervisor.sock ; path to your socket file
[supervisord]
logfile=/var/log/supervisord/supervisord.log ; supervisord log file
logfile_maxbytes=50MB ; maximum size of logfile before rotation
logfile_backups=10 ; number of backed up logfiles
loglevel=error ; info, debug, warn, trace
pidfile=/var/run/supervisord.pid ; pidfile location
nodaemon=false ; run supervisord as a daemon
@masak
masak / explanation.md
Last active July 9, 2024 17:07
How is git commit sha1 formed

Ok, I geeked out, and this is probably more information than you need. But it completely answers the question. Sorry. ☺

Locally, I'm at this commit:

$ git show
commit d6cd1e2bd19e03a81132a23b2025920577f84e37
Author: jnthn <jnthn@jnthn.net>
Date:   Sun Apr 15 16:35:03 2012 +0200

When I added FIRST/NEXT/LAST, it was idiomatic but not quite so fast. This makes it faster. Another little bit of masak++'s program.

@dgouldin
dgouldin / gist:3485236
Created August 27, 2012 03:10
Dead letter exchange based celery countdown implementation
class FrealCountdownTask(task.Task):
abstract = True
@classmethod
def apply_async(self, args=None, kwargs=None,
task_id=None, producer=None, connection=None, router=None,
link=None, link_error=None, publisher=None, add_to_parent=True,
**options):
try:
@hofmannsven
hofmannsven / README.md
Last active July 16, 2024 01:30
Git CLI Cheatsheet
@staltz
staltz / introrx.md
Last active July 22, 2024 09:31
The introduction to Reactive Programming you've been missing
@andrewmwilson
andrewmwilson / gmail_to_slack.js
Last active May 31, 2023 13:02
Google Apps Script: Send Gmail emails to Slack
// You will also need to create a gmail filter to add the 'send-to-slack' label
// to any emails you want sent to slack
function sendEmailsToSlack() {
var label = GmailApp.getUserLabelByName('send-to-slack');
var messages = [];
var threads = label.getThreads();
for (var i = 0; i < threads.length; i++) {
messages = messages.concat(threads[i].getMessages())
@mariocesar
mariocesar / README.md
Last active May 24, 2023 10:12
Django load secrets and settings from a safe file

This util manage to load django settings from a config file that contain sensitive information such as cache, database and project passwords/secrets.

The util also check the permissions file to be safe, and the existence of the SECRET_KEY variable, if no file is found it will automatically create a file with a random SECRET_KEY value.

How to use it?

Add the method load_environment_file into your code, an use it in your django

How to setup AWS lambda function to talk to the internet and VPC

I'm going to walk you through the steps for setting up a AWS Lambda to talk to the internet and a VPC. Let's dive in.

So it might be really unintuitive at first but lambda functions have three states.

  1. No VPC, where it can talk openly to the web, but can't talk to any of your AWS services.
  2. VPC, the default setting where the lambda function can talk to your AWS services but can't talk to the web.
  3. VPC with NAT, The best of both worlds, AWS services and web.
@judy2k
judy2k / parse_dotenv.bash
Created March 22, 2017 13:34
Parse a .env (dotenv) file directly using BASH
# Pass the env-vars to MYCOMMAND
eval $(egrep -v '^#' .env | xargs) MYCOMMAND
# … or ...
# Export the vars in .env into your shell:
export $(egrep -v '^#' .env | xargs)
@Fuyukai
Fuyukai / noclasses.py
Created March 14, 2018 23:08
Python, without classes.
def _suspend_self(namespace, suspended):
"""
Suspends a function, so that it has a self.
:param namespace: The self namespace to use.
:return: A function that will call the next function with self.
"""
def suspender(*args, **kwargs):
return suspended(namespace, *args, **kwargs)