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
function getRandom(arr, lastIndex) { | |
var index, size, distance; | |
size = arr.length; | |
do { | |
index = parseInt(Math.random() * size); | |
distance = Math.abs(index - lastIndex); | |
} while(size > 5 && distance < size / 3); | |
return index; | |
} |
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
import os | |
import time | |
import subprocess | |
print("Set layout to 'us'") | |
setxkbmap_command = ['setxkbmap', '-model', 'pc101', 'us', '-print'] | |
xkbcomp_command = ['xkbcomp', '-', os.environ.get('DISPLAY', ':0')] | |
xkbcomp = subprocess.Popen(xkbcomp_command, env=os.environ, stdin=subprocess.PIPE).stdin | |
subprocess.Popen(setxkbmap_command, |
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
#!/usr/bin/python3 | |
import os | |
import ssl | |
import imaplib | |
from configparser import ConfigParser | |
config_path = os.path.expanduser('~/.mailbot.conf') | |
parser = ConfigParser() | |
parser.read(config_path) |
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
<link rel="import" href="../core-drawer-panel/core-drawer-panel.html"> | |
<link rel="import" href="../core-icons/core-icons.html"> | |
<link rel="import" href="../core-icon/core-icon.html"> | |
<link rel="import" href="../core-menu/core-submenu.html"> | |
<link rel="import" href="../core-item/core-item.html"> | |
<link rel="import" href="../google-map/google-map.html"> | |
<polymer-element name="my-element"> | |
<template> |
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
import os | |
import json | |
def vdf_parse(steam_config_file, config): | |
line = " " | |
while line: | |
line = steam_config_file.readline() | |
if not line or line.strip() == "}": | |
return config |
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
#!/bin/bash | |
# installing dependencies | |
dependencies="libmonogame-cil ffmpeg mmv libopenal1 zenity" | |
install_deps=0 | |
for package in $dependencies; do | |
echo $package | |
dpkg -s $package | grep installed | |
if [ $? == 0 ]; then | |
install_deps=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
#!/bin/bash | |
# Resources | |
# http://www.gimpusers.com/tutorials/compiling-gimp-for-ubuntu | |
# http://ubuntuforums.org/showthread.php?p=11818979 | |
# | |
sudo apt-get build-dep gimp | |
sudo apt-get install libjpeg62-dev libopenexr-dev librsvg2-dev libtiff4-dev | |
mkdir gimp_build && cd gimp_build |
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
#!/usr/bin/python | |
import time | |
import os.path | |
while True: | |
if not os.path.exists("/dev/input/js0"): | |
break | |
else: | |
# Do stuff here |
NewerOlder