Skip to content

Instantly share code, notes, and snippets.

View timoteoramos's full-sized avatar
🏠
Working from home

Timóteo Ramos timoteoramos

🏠
Working from home
View GitHub Profile

Manual Rotate Script

It's a simple file or directory rotation script. Just set up the 2 variables (OBJECT and ROTATE) and run the script.

Example Usage

OBJECT="backup.tar.bz2" ROTATE=7 bash manualrotate.sh

[ `id -u` -ne 0 ] && [ -z "$TMUX" ] && tmux new-session -AD -s $HOSTNAME && exit 0
@timoteoramos
timoteoramos / pageant-helper.sh
Created February 12, 2019 14:39
Pageant Helper
#!/bin/sh
AGENT=/mnt/c/tools/weasel-pageant/weasel-pageant
PROFILE=~/.cache/.ssh-agent
mkdir -p "$(dirname "$PROFILE")" && touch $PROFILE
source $PROFILE &> /dev/null
if [ ! -e "$SSH_AUTH_SOCK" ]
then
$AGENT > $PROFILE
@timoteoramos
timoteoramos / xst.vbscript
Last active February 9, 2019 13:45
WSL vbscript launcher for X apps
WScript.CreateObject("WScript.Shell").Run "wsl ~ -d Ubuntu -e /bin/bash -c ""DISPLAY=:0 xrdb ~/.Xresources && DISPLAY=:0 xst""", 0, false
@timoteoramos
timoteoramos / telegram-stdout.py
Created September 25, 2018 20:49
telegram-stdout.py
#!/usr/bin/python3
# Remember to install the pyBotTelegramAPI package (usually from pip)
# It should works with Python 3.4 and above
import telebot, socket, subprocess, sys
BOT_TOKEN='<YOUR BOT TOKEN>'
DESTINATION='<DESTINATION ID>'
@timoteoramos
timoteoramos / etc-sybase9-mydb.sh
Created March 29, 2018 14:06
Sybase 9 with systemd (first attempt)
SVCNAME=sybase9-mydb
DBNAME=MYDB
DBPORT=2638
DBPATH=/srv/db
INITCACHE=2G
LOWCACHE=8G
UPCACHE=16G
@timoteoramos
timoteoramos / session.class.php
Last active November 10, 2017 20:16
GLPI Ticket Threshold
<?php
// Arquivo 'inc/session.class.php'
// Edite a função 'haveRight' para que ela fique similar ao exemplo abaixo
static function haveRight($module, $right) {
global $DB;
//If GLPI is using the slave DB -> read only mode
if ($DB->isSlave()
&& ($right & (CREATE | UPDATE | DELETE | PURGE))) {
@timoteoramos
timoteoramos / ldap_login.py
Created April 4, 2017 20:58
LDAP3 Simple authentication
from ldap3 import Connection, Server
import getpass
SERVER = '127.0.0.1'
SEARCH = 'cn=%s,cn=Users,dc=example,dc=com' % input('Username: ')
PASSWD = getpass.getpass()
with Connection(Server(SERVER, use_ssl=True), SEARCH, PASSWD, auto_bind=True) as conn:
print(conn)
conn.unbind()
@timoteoramos
timoteoramos / bugfix.sh
Created March 30, 2017 14:47
Debian Libvirt LXC issue
ln -s /dev/null /var/lib/lxc/mycontainer/rootfs/etc/systemd/system/console-getty.service
@timoteoramos
timoteoramos / GuidUtils.cs
Created February 16, 2017 19:05
.NET GUID Utils
using System;
public static class GuidUtils
{
public static Guid FromInt64(params long[] f)
{
byte[] result = new byte[16];
BitConverter.GetBytes (f [0]).CopyTo (result, 0);
BitConverter.GetBytes (f [1]).CopyTo (result, 8);