Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
# This is a minimal frontend to byzanz-record that provides a gui for
# selecting a region or window and length of a gif screen-cast.
# Depends on xrectsel (part of ffcast), byzanz-record, zenity
# Most code stolen from Rob W and MHC http://askubuntu.com/a/201018
DELAY=5
DEFDUR=10
TIME=$(date +"%Y-%m-%d_%H%M%S")
USERDUR=$(gdialog --title "Duration?" --inputbox "Please enter the screencast duration in seconds" 200 100 2>&1)
@97-109-107
97-109-107 / backup-anymongo.sh
Created July 7, 2014 08:59
A hopefully working backup script for mongo. Use by providing names of dbs to backup, check if MONGODUMP_DEST exist prior to executing.
#!/bin/bash
for var in "$@"
do
#Force file syncronization and lock writes
mongo admin --eval "printjson(db.fsyncLock())"
#Keep the trailing slash
MONGODUMP_DEST="/home/ubuntu/mongobackups/"
MONGO_DATABASE="$var"

How to install ipkg on a Synology DS214

After a couple of days of trying to get ipkg woking on my DS214 I found this article by trepmag. It is written for the DS213j, but it’s been working for me and others for the DS214 too.

I have done some minor changed to clarify some things, but if you are a Linux guy (unlike me) my changes might be of no use to you.

Guide

@97-109-107
97-109-107 / prepareXcolors.rb
Created April 19, 2015 15:56
This script parses xcolor-type files to the format supported by dynamic-colors https://github.com/sos4nt/dynamic-colors
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-.
require 'pathname'
# This script parses xcolor-type files to the format supported by dynamic-colors
# https://github.com/sos4nt/dynamic-colors
@xcolorsDirPath = ENV['HOME']+'/.config/themer/schemes/'
@destinationFolder = ENV['HOME']+'/.dynamic-colors/colorschemes/'
require 'open-uri'
200.times do
sleep 1
# data = open('http://localhost/_inc/server.php')
puts 'data'
end
@97-109-107
97-109-107 / alshflre
Created January 13, 2014 10:01
Crime Prevention / Rohit
<h2 id="examples">Examples</h2>
<p><strong><a href="http://www.ted.com/talks/nicholas_christakis_how_social_networks_predict_epidemics.html">Nicholas Christakis: How social networks predict epidemics</a></strong></p>
<p><img src="http://www.well.com/user/abs/Cyb/archive/c3m_1101_pix/EpidemicViz.jpg" alt="The Spread of Flu, Harvard College, 2009" title=""></p>
<blockquote>
<p>Want to predict the next big epidemic? Map real-life social networks, <br>
like friendships and workplace relationships. In this talk from <br>
TED@Cannes, Nicholas Christakis shows how monitoring the friends of <br>
@97-109-107
97-109-107 / openrct-scr.sh
Created July 10, 2016 15:54
Creates openrct2 scenario screenshots
#!/bin/sh
find ~/.config/OpenRCT2/Scenarios/ -iname "*sc6" -print0 | while IFS= read -r -d '' path; do
name=$(basename "$path")
$(openrct2 screenshot "$path" /tmp/Scenarios/"$name".png 1024 1024 0 50 3 0)
done
@97-109-107
97-109-107 / i3-quaketerm-spawn-if.py
Last active April 25, 2019 13:14
This scipt can emulate a drop down terminal behaviour with any kind of emulator (or application). The same can be achieved without an external script, but won't work if you have differently sized workspaced - hence the resize and repositioning calls. The script assumes that the you have a statusbar of 18px height on top of your workspace (see ba…
#!/usr/bin/env python
import i3
import re
import sys
from time import sleep
import json
#resize <grow|shrink> <direction> [<px> px [or <ppt> ppt]]
barHeight = 18
@97-109-107
97-109-107 / i3-get-current-screen.py
Last active September 19, 2019 15:46
get the size of current screen in i3wm
#!/usr/bin/env python
import i3
def getCurrentScreen():
workspace = [ws for ws in i3.get_workspaces() if ws['focused']][0]
screen_w =str(workspace['rect']['width'])
screen_h =str(workspace['rect']['height'])
print(screen_w, screen_h);
*background: #1e2132
*foreground: #c6c8d1
! black
*color0: #2a3158
*color8: #444b71
! red
*color1: #e27878
*color9: #e2a478
! green
*color2: #89b8c2