Skip to content

Instantly share code, notes, and snippets.

View scroobius-pip's full-sized avatar
🏠
Working from home

simdi jinkins scroobius-pip

🏠
Working from home
View GitHub Profile
@scroobius-pip
scroobius-pip / List_Python_Combination.py
Created October 2, 2016 04:34
Python comprehension to find all possible combinations of items in a list
[[x,y] for x in a for y in b]
where a and b is a list
@scroobius-pip
scroobius-pip / swap.js
Created October 3, 2016 23:11
Swapping values in es6
var a = 1;
var b = 3;
[a, b] = [b, a];
console.log(a); // 3
console.log(b); // 1
@scroobius-pip
scroobius-pip / list2Dictionary.py
Last active October 6, 2016 12:45
List to dictionary
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)) }
# 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):
@scroobius-pip
scroobius-pip / determinant.py
Last active October 17, 2016 00:30 — forked from willhbr/matrix.py
Python Matrix Determinant Calculator
#! 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 = []
@scroobius-pip
scroobius-pip / perfectelementary.bash
Created November 9, 2016 11:41
HowTo Install the perfect Elementary-OS
#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'
@scroobius-pip
scroobius-pip / reverse.c
Created February 22, 2017 06:13
String reversal function in c
#include <stdio.h>
#include <string.h>
#include <math.h>
char* reverse(char*);
int main(void) {
char s[] = "abcdefghijklmnopqrstuvwxyz";
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
@scroobius-pip
scroobius-pip / Swap.c
Created March 28, 2017 22:28
Swapping with only two variables
void s(int& a, int& b)
{
a = a ^ b;
b = a ^ b;
a = a ^ b;
}