Skip to content

Instantly share code, notes, and snippets.

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 February 25, 2018 12:33
git: recreate repository based on current files
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
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

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 December 25, 2014 20:15
B-Translator API Examples // source http://jsbin.com/juzipa
<!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 December 19, 2014 21:28
B-Translator API Examples // source http://jsbin.com/giweta
<!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 18:55
Codejam 2014, Round1C, Problem A
# 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
#div-output {
float: left;
margin: 2px 10px 5px 15px;
width: 100%;
}
#!/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

Easy Blogging With Emacs

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