This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[[x,y] for x in a for y in b] | |
where a and b is a list |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var a = 1; | |
var b = 3; | |
[a, b] = [b, a]; | |
console.log(a); // 3 | |
console.log(b); // 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def list2dict(L, keylist): return { x:y for (x,y) in zip(keylist, L) } | |
or | |
def list2dict(L,keylist): return {L[x]:keylist[x] for x in range(len(L)) } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding=UTF-8 | |
from __future__ import division | |
import re | |
# This is a naive text summarization algorithm | |
# Created by Shlomi Babluki | |
# April, 2013 | |
class SummaryTool(object): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! py | |
def solve(matrix, mul): | |
width = len(matrix) | |
if width == 1: | |
return mul * matrix[0][0] | |
else: | |
sign = -1 | |
total = 0 | |
for i in range(width): | |
m = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Download Elementary OS from here: | |
#http://sourceforge.net/projects/elementaryos/files/stable/ | |
#First you update your system | |
sudo apt-get update && sudo apt-get dist-upgrade | |
#Install Google Chrome | |
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add - | |
sudo sh -c 'echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
hhh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <string.h> | |
#include <math.h> | |
char* reverse(char*); | |
int main(void) { | |
char s[] = "abcdefghijklmnopqrstuvwxyz"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for f in *; do | |
if [[ -d $f ]]; then #if f is a directory | |
first="${f:0:1}" | |
echo $first | |
if [[ "$first" == +(a|b|c|A|B|C) ]] | |
then | |
mkdir -p ./A-C | |
mv "${f}" ./A-C | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void s(int& a, int& b) | |
{ | |
a = a ^ b; | |
b = a ^ b; | |
a = a ^ b; | |
} |
OlderNewer