Skip to content

Instantly share code, notes, and snippets.

Vladimir Bauer vbauerster

Block or report user

Report or block vbauerster

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View NoRepeatDigit45to4578
/**
*
* Print From 45 to 4578 Without Repeating Digits
*
* Write a method that prints all the numbers from 45 to 4578 to the console,
* with the constraint that you cannot print any number with repeating digits.
* This means the following numbers would be skipped: 11, 22, ...., 122, 110,....
*
* Created by vbauer on 19/04/14.
*/
View bsearch.js
var bsearch = function(arr, k){
var l = 0, r = arr.length-1, m;
console.log(arr);
while(l<r){
m = (l+r)/2^0;
console.log(m);
if(k>arr[m])
@vbauerster
vbauerster / Random.nextInt
Created May 5, 2014
java.util.Random.nextInt(n)
View Random.nextInt
public int nextInt(int n) {
if (n <= 0)
throw new IllegalArgumentException("n must be positive");
if ((n & -n) == n) // i.e., n is a power of 2
return (int)((n * (long)next(31)) >> 31);
int bits, val;
do {
bits = next(31);
@vbauerster
vbauerster / change_prompt.txt
Created May 11, 2014
terminal prompt modifications
View change_prompt.txt
PS1='\[\e]1;My Desk\a\e]2;${PWD}\a\]\
[\u@ME \w]\n \#\$ '
PS1='\[\e]2;${PWD}\a\
\e[0;34m\]\
[\u@MyMacBook \w]\n \#\$ \
\[\e[m\]'
#Default, but Working Dir in blue color
PS1='\h:\[\e[0;34m\]\W \[\e[m\]\u\$ '
@vbauerster
vbauerster / gist:78d48f1c3fa9f430e018
Last active Apr 8, 2018 — forked from jordelver/gist:3073101
Set the Mac OS X SOCKS proxy on the command line
View gist:78d48f1c3fa9f430e018

Set the Mac OS X SOCKS proxy on the command line

a.k.a. what to do when your ISP starts blocking sites :(

Set the SOCKS proxy to local SSH tunnel

networksetup -setsocksfirewallproxy "Ethernet" localhost 8080

To clear the domain and port

View objectEntries.js
function* objectEntries(obj) {
let propKeys = Reflect.ownKeys(obj);
for (let propKey of propKeys) {
yield [propKey, obj[propKey]];
}
}
let jane = { first: 'Jane', last: 'Doe' };
for (let [key, value] of objectEntries(jane)) {
View brew_uninstall.txt
cd `brew --prefix`
rm -rf Cellar
brew prune
rm `git ls-files`
rm -r Library/Homebrew Library/Aliases Library/Formula Library/Contributions
rm -rf .git
rm -rf ~/Library/Caches/Homebrew
View forever_local-npm.txt
forever start -e ~/.npm-local/err.log --plain --workingDir ~/.npm-local /usr/local/bin/local-npm
View playground.jsx
define(function(require){
//var React = require('react');
var jQuery = require('jquery');
//var TemplatesPanel = require('modules/pathboard/common/views/templatesPanel');
//var Templates = require('modules/pathboard/common/models/templates');
//var templates = new Templates();
//var Loading = require('ui/react/loading');
//var Panel = require('ui/react/modals/panel');
You can’t perform that action at this time.