Skip to content

Instantly share code, notes, and snippets.

@Sulter
Sulter / geoip
Last active November 7, 2020 21:40
A small python script that finds gelocation of IP addresses and host names, using http://freegeoip.net/.
#!/usr/bin/env python
import sys
import urllib.request
import json
def get_info(adress):
print("************************************************")
api = "http://freegeoip.net/json/" + adress
try:
@Sulter
Sulter / star.py
Created November 24, 2013 21:07
micro "physics" simulation? Just testing pygame.
import pygame
import sys
import math
import random
#vector stuff http://stackoverflow.com/a/4114962
def magnitude(v):
return math.sqrt(sum(v[i]*v[i] for i in range(len(v))))
def add(u, v):
@Sulter
Sulter / millis.c
Last active August 29, 2015 14:02
msec counter for avr.
/*
Calculated for 20MHz:
(((1sec/20000000) * 8 )* 250 )* 10 =0.001sec
freq presc ticks multiplayer 1msec
so at freq 20mhz, we need to prescale with 8, count to 249, and then multiple by 10 to get 1msec out of the counter.
This needs some calculations for each different frequency.
Adjust prescalar and ticks until you get the "multiplayer" to be an integer!
*/
@Sulter
Sulter / init.el
Last active October 30, 2017 19:05
emacs
;package preload/check
(require 'package)
(add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/"))
(package-initialize)
;git from emacs
(require 'magit)
;project management
(require 'projectile)
@Sulter
Sulter / lxterminal.conf
Created December 17, 2014 20:42
lxpanel settings
[general]
fontname=Monospace 11
selchars=-A-Za-z0-9,./?%&#:_
scrollback=5000
bgcolor=#000000000000
bgalpha=65535
fgcolor=#ffffffffffff
disallowbold=false
cursorblinks=false
cursorunderline=false
@Sulter
Sulter / readme
Last active January 14, 2023 17:00
screen+zmodem sending data
lrzsz package needed (debian) which include sz and rz
Sending from remote -> local
* screen into remote
* ctrl-a : zmodem catch
* 'sz filename' on the remote (in terminal)
Sending from local -> remote
* screen into remote
* ctrl-a : zmodem catch
@Sulter
Sulter / .bashrc
Last active September 24, 2016 16:36
function findString { grep --color=always -rn $1 -e "$2"; }
export -f findString
#file extractor
extract ()
{
if [ -f $1 ] ; then
case $1 in
*.tar.bz2) tar xvjf $1;;
*.tar.xz) tar xvJf $1;;
#!/bin/bash
if [ -z "$1" ]
then
FILE=main.elf
else
FILE=$1
fi
TOTAL_ROM=1000000
@Sulter
Sulter / piDetection.py
Created October 22, 2017 09:54
simple CV based detection for raspberry pi
# import the necessary packages
import argparse
import datetime
import time
import cv2
from picamera.array import PiRGBArray
from picamera import PiCamera
# construct the argument parser and parse the arguments
ap = argparse.ArgumentParser()
@Sulter
Sulter / movementDetector.py
Created October 22, 2017 10:29
Designed for surveillance over long periods of time
"""
TODO:
* only do caclulation if cooldown is finished
* make directory (opencv doesn't cast exceptions on write errors)
* sort from biggest to smallest area, and save the image with the biggest detection area of that frame shown.
"""
import argparse
import datetime
import time
import cv2