Skip to content

Instantly share code, notes, and snippets.

View psych0der's full-sized avatar

Mayank Bhola psych0der

View GitHub Profile
@psych0der
psych0der / firebase_copy.js
Created May 5, 2017 04:19 — forked from katowulf/firebase_copy.js
Move or copy a Firebase path to a new location
function copyFbRecord(oldRef, newRef) {
oldRef.once('value', function(snap) {
newRef.set( snap.value(), function(error) {
if( error && typeof(console) !== 'undefined' && console.error ) { console.error(error); }
});
});
}
@psych0der
psych0der / define.py
Created February 27, 2017 11:07 — forked from lambdamusic/define.py
Access osx dictionary in python
#!/usr/bin/env python
"""
Modified from
http://macscripter.net/viewtopic.php?id=26675
http://apple.stackexchange.com/questions/90040/look-up-a-word-in-dictionary-app-in-terminal
HowTo
@psych0der
psych0der / psa_doubt
Created March 15, 2014 16:03
python social auth social information QA
hi psych0der
psych0der
hey cadillac_
psych0der
i am bit cofused about accessing info about user object which is created in request
cadillac_
the social info?
psych0der
yes
psych0der
@psych0der
psych0der / recursive-sol
Created September 24, 2013 16:05
recursive solution to series : 1+2*4 + 3*5*7 + 4*6*8*10 .....
int level,sol; //level of recusrsion
printf("Enter the level\n");
scanf("%d",&level);
sol = solve(1);
int solve(int n)
{
int temp=1;
for(int i=1;i<n+1;i++)
@psych0der
psych0der / ftos.c
Created August 23, 2013 13:16
converting float to string without using library function like sprintf (naive approach , may lead to anomalies)
#include <stdio.h>
#include <math.h>
#define precision 6 //precision for decimal digits
int main(int argc, char const *argv[])
{
float f,ff;
@psych0der
psych0der / fast-exponential.c
Created August 22, 2013 16:56
fast exponential calculation using repeated squaring
int expo(int a, int b){
int result = 1;
while (b)
{
if (b%2==1)
{
result *= a;
}
b /= 2;