Skip to content

Instantly share code, notes, and snippets.

@guysoft
guysoft / pidginAutoAway.sh
Last active October 11, 2015 03:18
A simple script that makes pidgin go automaticly idle away when AFK (uses xprintidle and purple-remote)
#!/bin/bash
#Simple pidgin Auto-Away
#By Guy Sheffer (GuySoft) <guysoft at gmail dot com>
#Set time
IDLE_TIME_MIN=15
FIX=60000
#SHIFT=16200000
SHIFT=0
@guysoft
guysoft / voting.m
Created January 22, 2013 15:18
Calculate a quick an dirty prediction for vote percentage in Israel 2013 elections
clear all
y1973= [21.8 33.1 41.4 54.1 65.2 73.4 78.6]'
y1977= [16.8 31.3 42.4 50.6 60.2 71.4 79.2]'
y1981= [17 30.2 39.4 47 57 69.6 78.5]'
y1984= [15.6 29.8 39.8 47.2 55.6 68.9 78.8]'
y1988= [14.8 29.3 42.1 52.9 65.2 75.6 79.7]'
y1992= [14 27.5 38.4 47 56.3 68.2 77.4]'
y1996= [14.3 28.9 41.3 50.6 60 70.9 79.3]'
y1999= [14.2 28.9 41.7 51.8 60.9 71.4 78.7]'
y2003= [10.1 24 35.3 44.2 52.8 62.8 67.8]'
@guysoft
guysoft / email.py
Created August 7, 2014 14:02
send email
#!/usr/bin/python
import smtplib
import sys
import string
fromaddr = '<your gmail address>'
toaddrs = '<destination address>'
msg = sys.argv[1]
subject = "3D printer message"
--- Makefile.vc10.orig 2014-09-11 20:19:32.000000000 +0300
+++ Makefile.vc10 2014-10-21 14:59:35.573868800 +0300
@@ -114,7 +114,7 @@
## Release
CCR = cl.exe $(RTLIB) /O2 /DNDEBUG
-LINKR = link.exe /incremental:no /libpath:"../lib"
+LINKR = link.exe /incremental:no /libpath:"../lib" libssh2.lib libeay32.lib ssleay32.lib zlib.lib
RCR = rc.exe /dDEBUGBUILD=0
@guysoft
guysoft / parse.py
Last active April 8, 2017 12:22
Parse arguments
a='base(octopi,a(b,c(a2)),mm)'
def parse(a):
stack=[]
token = ""
for char in a:
if char == "(":
stack.append(token)
if token != "":
#!/usr/bin/env python3
"""
Play a file continously, and exit gracefully on signal
Based on https://github.com/steveway/papagayo-ng/blob/working_vol/SoundPlayer.py
@author Guy Sheffer (GuySoft) <guysoft at gmail dot com>
"""
import signal
import time
@guysoft
guysoft / timezone_bot.y
Created August 10, 2017 14:51
A telegram bot that lets you pick a timezone
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
A telegram bot that lets you pick and a timezone
@author Guy Sheffer (GuySoft) <guysoft at gmail dot com>
"""
from telegram.ext import Updater
from telegram.ext import CommandHandler
from telegram.ext import ConversationHandler, RegexHandler
#!/usr/bin/env bash
sudo apt-get install -y ca-certificates git sudo scren python3
wget https://releases.hashicorp.com/vagrant/2.0.3/vagrant_2.0.3_x86_64.deb
dpkg -i vagrant_2.0.3_x86_64.deb
#Install virtualbox
echo "deb http://download.virtualbox.org/virtualbox/debian stretch contrib" > /etc/apt/sources.list.d/virtualbox.list
wget -q -O- http://download.virtualbox.org/virtualbox/debian/oracle_vbox_2016.asc | apt-key add -
apt-get update; apt-get install -y virtualbox-5.2
/sbin/vboxconfig
# Example configuration file for HAProxy 1.3, refer to the url below for
# a full documentation and examples for configuration:
# http://haproxy.1wt.eu/download/1.3/doc/configuration.txt
# Global parameters
global
# Log events to a remote syslog server at given address using the
# specified facility and verbosity level. Multiple log options
# are allowed.
@guysoft
guysoft / reminders.py
Created December 31, 2018 10:05
Get google calendar reminder api
#!/usr/bin/env python3
## How to use
##
## 1. enter http://calendar.google.com/
## 2. press ctrl+alt+J in chrome to ender the developer tools and select the "network" tab. In firefox ctrl+shift+elif
## 3. refresh and make sure "reminders" is checked.
## 4. search for "reminder" in url filters and look for a url of the form: https://reminders-pa.clients6.google.com/v1internalOP/reminders/list?key=
## 5. Copy the key and the followind headers and cookies below:
## For mor info see: https://issuetracker.google.com/issues/36760283