Skip to content

Instantly share code, notes, and snippets.

View nhocki's full-sized avatar
💭
I may be slow to respond.

Nicolás Hock-Isaza nhocki

💭
I may be slow to respond.
View GitHub Profile
//Convierte un numero N en base B a decimal
public int toDecimal(int n, int b)
{
int result=0;
int multiplier=1;
while(n>0)
{
result+=n%10*multiplier;
multiplier*=b;
set<int>f,s,tmp;
set_intersection(all(f),all(s), inserter(tmp, tmp.begin()));
@nhocki
nhocki / gist:300836
Created February 10, 2010 21:07
LIS
#include <algorithm>
#include <iostream>
#include <cmath>
#include <cstring>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <vector>
using namespace std;
@nhocki
nhocki / LCS
Created February 19, 2010 02:47
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <string>
#include <cstdlib>
#include <vector>
#include <set>
#include <map>
#include <iostream>
#include <set>
using namespace std;
const int MAXN = 50005;
int p[MAXN];
int find(int u){
if (p[u] == u) return u;
return p[u] = find(p[u]);
export ARCHFLAGS="-arch i386 -arch x86_64" ;sudo gem install --no-rdoc --no-ri -v=2.7 mysql -- --with-mysql-dir=/opt/local/bin/mysql5 --with-mysql-config=/opt/local/lib/mysql5/bin/mysql_config
$("#dialog").dialog({
bgiframe: true,
autoOpen: false,
height: 600,
width: 500,
modal: true,
buttons: {
'Lend Asset': function() {
$("#new_lending").submit();
$(this).dialog('close');
@nhocki
nhocki / gist:356762
Created April 5, 2010 19:36
Copy your public key to a server
cat .ssh/id_rsa.pub | ssh [email protected] "cat >> .ssh/authorized_keys"
(defun toggle-fullscreen ()
(interactive)
(set-frame-parameter nil 'fullscreen (if (frame-parameter nil 'fullscreen)
nil
'fullboth)))
(global-set-key [(meta return)] 'toggle-fullscreen)
alias rmb='echo -n "Really clean this directory? [y/n] ";
read yorn;
if test "$yorn" = "y"; then
rm -f \#* *~ .*~ *.bak .*.bak *.tmp .*.tmp core a.out;
echo "Cleaned";
else
echo "Not Cleaned";
fi'
# alias emacs='open /Applications/Emacs.app'