Skip to content

Instantly share code, notes, and snippets.

View klepsydra's full-sized avatar

Marcos Koby klepsydra

  • US
View GitHub Profile
@Osse
Osse / gist:9553403
Created March 14, 2014 18:07
Cannot shutdown
$ sudo systemctl poweroff
Failed to start poweroff.target: Connection timed out
$ sudo shutdown -h now
Failed to start poweroff.target: Activation of org.freedesktop.systemd1 timed out
Failed to open /dev/initctl: No such device or address
Failed to talk to init daemon.
@klepsydra
klepsydra / gist:2286570
Created April 2, 2012 19:29
triglist.GPW.txt
BUY WARFAMA 20120327 1.52 18.57923 2595257 lastprice=1.67 targetprice=1.35 quantity>=569.80
BUY TRAKCJA 20120323 1.21 18.40000 7787679 lastprice=1.16 targetprice=.94 quantity>=818.32
BUY DSS 20120322 4.62 18.39286 1250754 lastprice=3.70 targetprice=3.01 quantity>=255.55
BUY ABMSOLID 20120330 3.20 18.36735 3341862 lastprice=3.14 targetprice=2.56 quantity>=300.48
BUY BIOTON 20120329 0.10 18.18182 1713404 lastprice=0.09 targetprice=.07 quantity>=10989.00
BUY CIECH 20120320 16.45 12.26667 6342807 lastprice=16.65 targetprice=14.60 quantity>=52.68
BUY SKOTAN 20120319 3.03 11.38462 5863662 lastprice=3.57 targetprice=3.16 quantity>=243.42
BUY OVOSTAR 20120328 111.90 10 1003295 lastprice=109.20 targetprice=98.28 quantity>=7.82
BUY MIDAS 20120321 0.90 8.33333 11032438 last
@klepsydra
klepsydra / ST.50209607.statsTable.txt
Created April 2, 2012 19:45
ST.50209607.statsTable.txt
+----------------+---------------+---------------+---------------+
| Performance of Scottrade_50209607, 2012-04-02T00:24:33+02:00 |
+----------------+---------------+---------------+---------------+
|group |Unrealized |Realized |Combined |
+----------------+---------------+---------------+---------------+
| openValueSum | 2347.31 | 3056.22 | 1865.23 |
| closeValueSum | 2365.24 | 3132.37 | 1883.16 |
| gainLossRaw | 17.93 | 76.15 | 94.08 |
| profitSum | 17.93 | 76.15 | 94.08 |
| gainLossPerc | 0.76 | 2.49 | 5.04 |
anonymous
anonymous / gist:4169393
Created November 29, 2012 14:19
Patched ruby psych to handle multiline regexp
module Psych
module Visitors
class ToRuby < Psych::Visitors::Visitor
def deserialize o
if klass = Psych.load_tags[o.tag]
instance = klass.allocate
if instance.respond_to?(:init_with)
coder = Psych::Coder.new(o.tag)
coder.scalar = o.value
@himynameisjonas
himynameisjonas / kittens.js
Created March 1, 2011 06:48
replace all images with kittens
jQuery("body").find('img').each(function(i,img) {
var w = img.width;
var h = img.height;
if (w && h) {
var src = 'http://placekitten.com/'+w+'/'+h;
img.src = src;
}
});
// code from https://github.com/lsemel/jquery-placekitten
@abarringer
abarringer / gist:846621
Created February 27, 2011 22:24
Convert XML to SQLite
require 'rubygems'
require 'sqlite3'
require 'rexml/document'
include REXML
xml =<<XML
<records>
<entry><name>abc</name><qty>3</qty></entry>
<entry><name>def</name><qty>5</qty></entry>
<entry><name>ghi</name><qty>2</qty></entry>
@franzalex
franzalex / TextArea_Backup_with_Expiry_Fix.user.js
Last active April 3, 2018 08:24
Creates a backup of input and textArea fields for restoration after data loss. It offers similar functionality as the Lazarus Firefox extension which is no longer supported.
// ==UserScript==
// @author Crend King
// @contributor Franz Alex Gaisie-Essilfie
// @version 2.4.20170620
// @name Textarea Backup with expiry Fix
// @namespace http://users.soe.ucsc.edu/~kjin
// @description Fix @grant https://greasyfork.org/zh-CN/forum/discussion/8161
// @description Retains text entered into textareas and contentEditables, and expires after certain time span.
// @include http://*
// @include https://*
@maxgalbu
maxgalbu / Switch_Node.php
Last active December 31, 2019 16:03
Switch tag for Twig, updated from https://github.com/fabpot/Twig/pull/185 to work with Twig >= 1.12
<?php
//To be added under Twig/Node/Switch.php
/*
* This file is part of Twig.
*
* (c) 2009 Fabien Potencier
* (c) 2009 Armin Ronacher
*
@Integralist
Integralist / Hash Keys to Symbols.rb
Last active September 2, 2020 08:50
Convert Ruby Hash keys into symbols
hash = { 'foo' => 'bar' }
# Version 1
hash = Hash[hash.map { |k, v| [k.to_sym, v] }]
# Version 2
hash = hash.reduce({}) do |memo, (k, v)|
memo.tap { |m| m[k.to_sym] = v }
end
@mikiobraun
mikiobraun / autoreload.rb
Created January 15, 2010 15:14
autoreloading of ruby files which have changed in the meantime
# This file extends the Kernel's require function and adds the
# AutoReload module which allows to reload files once they have changed
# on the disk.
#
# Basically, you just require your files as usual, and if you want to update
# the files, either call AutoReload.reload(file) or AutoReload.reload_all.
#
# Usage:
# irb -rautoload
#