Skip to content

Instantly share code, notes, and snippets.

View troublesort.py
def troublesort(V):
done = False
while not done:
done = True
for i in range(len(V)-2):
if V[i] > V[i+2]:
done = False
V[i], V[i+2] = V[i+2], V[i]
def check(V):
@dashohoxha
dashohoxha / gist:8fe4b429e853fe82f4a17d185008bb74
Created Feb 25, 2018 — forked from elvisciotti/gist:37b99aeff8ff50ebe80a
git: recreate repository based on current files
View gist:8fe4b429e853fe82f4a17d185008bb74
cp .git/config /tmp/gitBackup
rm -rf .git
git init
cp /tmp/gitBackup .git/config
git remote add origin <url from 1st command>
git add .
git status
git commit -m "rewrite history"
git push -f
View stalls.rb
def solve(n, k)
l = 0
p2 = 1 # 2**0
k1 = k
n1 = n
chunk = n
while (k1 - p2 > 0)
k1 -= p2
n1 -= p2
chunk -= 1
View keybase.md

Keybase proof

I hereby claim:

  • I am dashohoxha on github.
  • I am dashohoxha (https://keybase.io/dashohoxha) on keybase.
  • I have a public key ASClLI_RjQu6KDeKRN9_rdFd2cAI6QJ8fd7L2eckpxwIGwo

To claim this, I am signing this object:

@dashohoxha
dashohoxha / index.html
Created Dec 25, 2014
B-Translator API Examples // source http://jsbin.com/juzipa
View index.html
<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
<link rel="stylesheet" href="http://info.btranslator.org/api-examples-js/style.css" type="text/css" />
<script src="http://info.btranslator.org/api-examples-js/config.js"></script>
<script src="http://info.btranslator.org/api-examples-js/http_request.js"></script>
<script src="http://info.btranslator.org/api-examples-js/debug.js"></script>
<script src="http://info.btranslator.org/api-examples-js/get_access_token.js"></script>
@dashohoxha
dashohoxha / index.html
Created Dec 19, 2014
B-Translator API Examples // source http://jsbin.com/giweta
View index.html
<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
<link rel="stylesheet" href="http://info.btranslator.org/api-examples-js/style.css" type="text/css" />
<script src="http://info.btranslator.org/api-examples-js/config.js"></script>
<script src="http://info.btranslator.org/api-examples-js/http_request.js"></script>
<script src="http://info.btranslator.org/api-examples-js/get_access_token.js"></script>
@dashohoxha
dashohoxha / partelf.rb
Created May 11, 2014
Codejam 2014, Round1C, Problem A
View partelf.rb
# Problem description: https://code.google.com/codejam/contest/3004486/dashboard#s=p0
powers = [1]
nr = 1
41.times do
nr = nr * 2
powers << nr
end
T = gets.to_i
View jsbin.giweta.css
#div-output {
float: left;
margin: 2px 10px 5px 15px;
width: 100%;
}
View speak.sh
#!/bin/bash
rawurlencode() {
local string="${1}"
local strlen=${#string}
local encoded=""
for (( pos=0 ; pos<strlen ; pos++ )); do
c=${string:$pos:1}
case "$c" in
View easy-blogging-with-emacs.org

Easy Blogging With Emacs

Time after time I write technical blogs and articles that describe and