Skip to content

Instantly share code, notes, and snippets.

View vishaltelangre's full-sized avatar

Vishal Telangre vishaltelangre

View GitHub Profile
@konklone
konklone / ssl.rules
Last active August 8, 2023 08:39
nginx TLS / SSL configuration options for konklone.com
# Basically the nginx configuration I use at konklone.com.
# I check it using https://www.ssllabs.com/ssltest/analyze.html?d=konklone.com
#
# To provide feedback, please tweet at @konklone or email eric@konklone.com.
# Comments on gists don't notify the author.
#
# Thanks to WubTheCaptain (https://wubthecaptain.eu) for his help and ciphersuites.
# Thanks to Ilya Grigorik (https://www.igvita.com) for constant inspiration.
server {
Knuth: Structured Programming with go to Statements
http://cs.sjsu.edu/~mak/CS185C/KnuthStructuredProgrammingGoTo.pdf
There is no doubt that the grail of efficiency leads to abuse. Programmers waste enormous amounts
of time thinking about, or worrying about, the speed of noncritical parts of their programs, and
these attempts at efficiency actually have a strong negative impact when debugging and maintenance
are considered. We should forget about small efficiencies, say about 97% of the time: premature
optimization is the root of all evil.
Yet we should not pass up our opportunities in that critical 3 %.
@kmayer
kmayer / sidekiq.rb
Created September 8, 2013 17:41
Sidekiq Exception tracer for NewRelic Add this to your sidekiq initializer
module NewRelic
class SidekiqException
def call(worker, msg, queue)
begin
yield
rescue => exception
NewRelic::Agent.notice_error(exception, :custom_params => msg)
raise exception
end
end
@estum
estum / user.rb
Last active December 21, 2015 05:49
Migrate passwords from legacy systems to Devise
# updated variant of older solution:
# http://www.davidverhasselt.com/2012/05/13/how-to-migrate-passwords-from-legacy-systems-to-devise
class User < ActiveRecord::Base
# ...
def valid_password?(password)
if legacy_password?
# Use Devise's secure_compare to avoid timing attacks
@aras-p
aras-p / preprocessor_fun.h
Last active May 8, 2024 06:45
Things to commit just before leaving your job
// Just before switching jobs:
// Add one of these.
// Preferably into the same commit where you do a large merge.
//
// This started as a tweet with a joke of "C++ pro-tip: #define private public",
// and then it quickly escalated into more and more evil suggestions.
// I've tried to capture interesting suggestions here.
//
// Contributors: @r2d2rigo, @joeldevahl, @msinilo, @_Humus_,
// @YuriyODonnell, @rygorous, @cmuratori, @mike_acton, @grumpygiant,
@artagnon
artagnon / chennai-travel.txt
Created August 1, 2013 09:38
What to do in Chennai
I'll exclude what you can find easily on Wikitravel:
- The city organizes carnatic music concerts every now and then called
"kutcheris". Ask a friend interested in music to take you to one.
- It's less cosmopolitan than consumerist than many other cities
(eg. Bangalore); very few avenues for spending. Avoid the big chains
(Cafe Coffee Day, Kentucky Fried Chicken, Dominos Pizza etc): you'll
have plenty of time to check them out in other Indian cities. The
big weekend activity for a family is going out for dinner: so, check
@jasonrudolph
jasonrudolph / 00-about-search-api-examples.md
Last active April 30, 2024 19:21
5 entertaining things you can find with the GitHub Search API
@vparihar01
vparihar01 / setting_hostname_sendmail_in_ubuntu.md
Created June 27, 2013 11:55
For changing the mail hosts name from your local machine name to domain name.Setting the hostname in sendmail.

If you need to change the hostname that Sendmail announces itself as, just add the following to sendmail.mc:

define(`confDOMAIN_NAME', `mail.yourdomain.com')dnl

For example-: Your domain name is www.xyz.com, then

define(`confDOMAIN_NAME', `www.xyz.com')dnl
@fracasula
fracasula / getMp3StreamTitle.php
Last active April 24, 2024 00:38
How to get the MP3 metadata (StreamTitle) from a streaming URL
<?php
/**
* Please be aware. This gist requires at least PHP 5.4 to run correctly.
* Otherwise consider downgrading the $opts array code to the classic "array" syntax.
*/
function getMp3StreamTitle($streamingUrl, $interval, $offset = 0, $headers = true)
{
$needle = 'StreamTitle=';
$ua = 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.110 Safari/537.36';