Skip to content

Instantly share code, notes, and snippets.

@guysoft
guysoft / email.py
Created August 7, 2014 14:02
send email
View email.py
#!/usr/bin/python
import smtplib
import sys
import string
fromaddr = '<your gmail address>'
toaddrs = '<destination address>'
msg = sys.argv[1]
subject = "3D printer message"
View curl makefile diff
--- 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 / 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)
View pidginAutoAway.sh
#!/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
View voting.m
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 / parse.py
Last active April 8, 2017 12:22
Parse arguments
View parse.py
a='base(octopi,a(b,c(a2)),mm)'
def parse(a):
stack=[]
token = ""
for char in a:
if char == "(":
stack.append(token)
if token != "":
View Zynthian deployment
#!/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
View tami haproxy
# 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.
View install_slic3r.sh
#!/bin/bash
sudo sed -i '/^CONF_SWAPSIZE.*/s//CONF_SWAPSIZE=1000/' /etc/dphys-swapfile
SLIC3R_REPO="https://github.com/alexrj/Slic3r.git"
SLIC3R_VERSION="master"
SLIC3R_DIR=/home/pi/Slic3r
sudo apt-get update
sudo apt-get install -y git libboost-all-dev libboost-geometry-utils-perl libboost-system-dev libboost-thread-dev git-core build-essential libgtk2.0-dev libwxgtk2.8-dev libwx-perl libmodule-build-perl libnet-dbus-perl cpanminus libextutils-cbuilder-perl gcc-4.7 g++-4.7 libwx-perl libperl-dev libextutils-cppguess-perl libeigen3-dev libglew-dev libglewmx-dev cpanminus
sudo apt install -y git libboost-all-dev libboost-geometry-utils-perl libboost-system-dev libboost-thread-dev git-core build-essential libwxgtk3.0-dev libgtk-3-dev libwx-perl libmodule-build-perl libnet-dbus-perl cpanminus gcc-4.7 g++-4.7 libwx-perl libperl-dev libextutils-cppguess-perl libeigen3-dev libglew-dev cpanminus libcurl4-openssl-dev
sudo cpan ExtUtils::CBuilder ExtUtils::CppGuess Alien::wxWidgets CPAN::Mini ExtUtils::XSpp::Cmd Ex
@guysoft
guysoft / kivyconsole.py
Last active September 20, 2019 12:29 — forked from aron-bordin/kivyconsole.py
Initial Python/Kivy Terminal Emulator (It's just a performance test. You can use this sample to write your own terminal emulator)
View kivyconsole.py
from kivy.base import runTouchApp
from kivy.event import EventDispatcher
from kivy.lang import Builder
from kivy.properties import ObjectProperty, ListProperty, StringProperty, \
NumericProperty, Clock, partial
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.textinput import TextInput
import os
import subprocess
@guysoft
guysoft / rootsystem_backup.lst
Created October 20, 2019 13:06
Nightly snapshot script, needs an email script at /home/guy/stuff/scripts/email
View rootsystem_backup.lst
# Include
+ /dev/console
+ /dev/initctl
+ /dev/null
+ /dev/zero
# Exclude
- /dev/*
- /run/*
- /proc/*