Skip to content

Instantly share code, notes, and snippets.

View bakkiraju's full-sized avatar

Bilahari bakkiraju

View GitHub Profile
String tokenizing in c++
=======================
#include <sstream>
string s = "data structures and algorithms practice";
istringstream iss;
iss.str(s);
string token;
while (getline(iss, token, ' '))
{
oss << token << " ";
@bakkiraju
bakkiraju / The Technical Interview Cheat Sheet.md
Created August 27, 2019 10:05 — forked from tsiege/The Technical Interview Cheat Sheet.md
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.

Studying for a Tech Interview Sucks, so Here's a Cheat Sheet to Help

This list is meant to be a both a quick guide and reference for further research into these topics. It's basically a summary of that comp sci course you never took or forgot about, so there's no way it can cover everything in depth. It also will be available as a gist on Github for everyone to edit and add to.

Data Structure Basics

###Array ####Definition:

  • Stores data elements based on an sequential, most commonly 0 based, index.
  • Based on tuples from set theory.
@bakkiraju
bakkiraju / gist:ea2f70eb599e22b654e9025a1c23df6d
Created January 25, 2018 06:30
Finding out if a shell script ran to completion using ObjC
NSBundle* myBundle = [NSBundle mainBundle];
NSString* myScript = [myBundle pathForResource:@"isScriptRunning"
ofType:@"sh"
inDirectory:@"ScriptsDir"];
NSTask *task;
task = [[NSTask alloc] init];
#if !__has_feature(objc_arc)
[task autorelease];
#endif
@bakkiraju
bakkiraju / gist:bf3d0bf77c3e1fc01b515c79c7b2df67
Created November 15, 2017 05:19
[objC] Setting up universal exception handler in NSApplication
void BAUncaughtExceptionHandler (NSException* exception);
int main (int argc, const char* argv[])
{
BASetUncaughtExceptionHandler (&AZUncaughtExceptionHandler);
}
void BAUncaughtExceptionHandler (
@bakkiraju
bakkiraju / gist:92eb20d729644154f9e4840e5e8f5bc9
Created November 6, 2017 22:57
blockstack registration
Verifying my Blockstack ID is secured with the address 1GDbaVgBALwRXXBEbgm1jP2r6VkFFG3GC1 https://explorer.blockstack.org/address/1GDbaVgBALwRXXBEbgm1jP2r6VkFFG3GC1
@bakkiraju
bakkiraju / linuxfunda.txt
Last active April 9, 2017 03:45
Linux kernel Concepts
Reference:Linux programmers toolbox by John Fusco
Userspace:
Linux is a multiuser operating system, so one process should not be allowed to view another process’s memory,
which could contain passwords or sensi- tive information. User mode ensures that a process sees only memory that belongs to it. Moreover, if the process corrupts its internal structures, it can crash only itself; it will not take any other processes with it and certainly not the whole system.
The memory that the process sees when in user mode is called user space.
Kernel Space:
Because the kernel is executed by every process in the system, every process needs access to a common memory region.
To preserve security, however, the kernel code and data structures must be strictly iso- lated from user code and data.
@bakkiraju
bakkiraju / js
Created March 22, 2017 02:31
MultiController-AngularJS example
<!DOCTYPE html>
<html>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
<body>
<div ng-app="myApp">
<div ng-controller="personCtrl">
First Name: <input type="text" ng-model="firstName"><br>
Last Name: <input type="text" ng-model="lastName"><br>
@bakkiraju
bakkiraju / gist:bed042bb7f659fd99c748c7a32b835d5
Created February 7, 2017 06:47
Always on the Top, click through transparent window in Swift
import Cocoa
@NSApplicationMain
class AppDelegate: NSObject, NSApplicationDelegate {
@IBOutlet weak var window: NSWindow!
func applicationDidFinishLaunching(_ aNotification: Notification) {
@bakkiraju
bakkiraju / gist:47f8f228be2f0ae739c284be041b228f
Last active January 27, 2017 22:35
Important Redux concepts culled out from redux.js.org
Redux attempts to make state mutations predictable by imposing certain restrictions on how and when updates can happen.
These restrictions are reflected in the three principles of Redux.
- State is single source of truth
- State is read-only
- Changes are made with pure functions
Key terms and concepts:
State:
@bakkiraju
bakkiraju / substringMatchScore.cpp
Created December 2, 2016 01:07
substring which would be closest (max overlap) to a given prefix and suffix
#include <iostream>
#include <string>
using namespace std;
int returnMatchCount(const string &s1, const string &s2)
{
int cnt = 0;
for (int i = s1.length()-1; i >=0; i--) {
string sub_sub = s1.substr(i,s1.length()-i);