Skip to content

Instantly share code, notes, and snippets.

@looio
looio / fabfile.py
Created September 17, 2016 12:00 — forked from yuchant/fabfile.py
def pull_down_remote_db():
""" Export database and files.
"""
local_db_dump_path = os.path.join(PROJECT_ROOT, 'remote_db_dump/auto_db_dump.sql')
with settings(sudo_user='postgres'):
with cd('/var/lib/postgresql'):
run('pwd')
print("Dumping database on remote..")
sudo('pg_dump db_krownlab > auto_db_dump.sql')
@looio
looio / daemon.py
Created September 2, 2016 14:19 — forked from superdachs/daemon.py
Python daemon example
#!/usr/bin/env python
# coding: utf-8
import argparse
import os
import sys
import time
import atexit
import logging
import signal
@looio
looio / daemon.py
Created September 2, 2016 14:18 — forked from marazmiki/daemon.py
Python daemon example
#!/usr/bin/env python
# coding: utf-8
import argparse
import os
import sys
import time
import atexit
import logging
import signal
@looio
looio / watchdog.md
Created September 2, 2016 14:16 — forked from Spindel/watchdog.md
Showing off the systemd watchdog in Python

Watchdogged

Place the service file (or a link to it) in /etc/systemd/system/ Place the watchdogged.py file somewhere ( and change the ExecStart portion in the .service to point at the file )

then do systemctl daemon-reload followed by systemctl start watchdogged.service

After this you can watch the progress using journalctl --follow -u watchdogged.service change the PROBABILITY variable to something else to watch it faster/later or succeed.

@looio
looio / CSV Duplication Remover
Created July 25, 2016 14:04 — forked from murphyslaw/CSV Duplication Remover
A ruby script that removes duplicate rows in a csv file. Duplicates are found based on an identifier column and a criteria column, which are configurable.
#!/usr/bin/ruby -w
require 'csv'
require 'active_support/core_ext'
class Parser
attr_accessor :input_folder
attr_accessor :output_folder
attr_accessor :filename
@looio
looio / scraping.rb
Created July 13, 2016 14:14 — forked from ngauthier/scraping.rb
Scraping the Web with Ruby Code
#!/usr/bin/env ruby
# From: http://ngauthier.com/2014/06/scraping-the-web-with-ruby.html
require 'capybara'
require 'capybara/poltergeist'
require 'csv'
require 'gdbm'
class NickBot
include Capybara::DSL
@looio
looio / incomestatement.csv
Created July 6, 2016 02:35 — forked from jbgh/incomestatement.csv
Ruby Fundamentals IV Challenge
Date Volume Revenue COGS Net Profit
20131122 59 254.5 44.65000000000001 209.85
20131123 110 459.0 85.55000000000001 373.45
@looio
looio / prepare_icons.sh
Created July 5, 2016 09:07 — forked from Lerg/prepare_icons.sh
Make all app icons with imagemagick, iOS and Android
#!/bin/sh
base=$1
convert "$base" -resize '29x29' -unsharp 1x4 "Icon-Small.png"
convert "$base" -resize '40x40' -unsharp 1x4 "Icon-Small-40.png"
convert "$base" -resize '50x50' -unsharp 1x4 "Icon-Small-50.png"
convert "$base" -resize '57x57' -unsharp 1x4 "Icon.png"
convert "$base" -resize '58x58' -unsharp 1x4 "[email protected]"
convert "$base" -resize '60x60' -unsharp 1x4 "Icon-60.png"
convert "$base" -resize '72x72' -unsharp 1x4 "Icon-72.png"
convert "$base" -resize '76x76' -unsharp 1x4 "Icon-76.png"
@looio
looio / simple_image_downloader.py
Created June 7, 2016 11:29 — forked from Mistoreaa/simple_image_downloader.py
Image downloader. You can download images from the web site.
# coding:utf-8
import sys
import os
import re
import time
import math
from urllib import request, error
from http import cookiejar
@looio
looio / tinypng.py
Created May 11, 2016 07:21 — forked from border/tinypng.py
The Tinify API allows you to compress and optimize JPEG and PNG images. Base on https://tinypng.com/developers/reference/python
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import os
import getopt
import tinify
tinify.key = 'YOUR_API_KEY'