Skip to content

Instantly share code, notes, and snippets.

View LeoAdamek's full-sized avatar

Leo Adamek LeoAdamek

View GitHub Profile
@LeoAdamek
LeoAdamek / stack.c
Created February 2, 2012 19:59
A simple demonstration of stacks in ANSI C
/*
* stacks.c
*
* An example (and probably not great) stack implimentation in ANSI C
* Licensed under "Do what you want" by Leo Adamek (leo.adamek.me), 2012
*
* Notes:
* This program is a demonstration of stacks in C.
* The main function of this program is just a demonstration of the stack
*/
@LeoAdamek
LeoAdamek / f.scala
Created November 9, 2012 19:09
Factorial Operator
object f {
def f(x: BigInt):BigInt = if(x < 2) 1 else x * f(x-1)
implicit def factorial_operator(x: BigInt) = new { def ! = f(x) }
def main(args: Array[String]){
args.foreach {
i => {
println(i + "! = " + (BigInt.apply(i)!) )
}
}
@LeoAdamek
LeoAdamek / wallbase.py
Created January 20, 2013 23:28
A Wallbase downloader with lotsa options. Writing it to set a cron job for `feh`
#!/usr/bin/python
import re
import argparse
from pyquery import PyQuery as Q
from lxml import etree
def main():
opts = parse_args()
@LeoAdamek
LeoAdamek / wallbase.py
Last active December 11, 2015 10:48
Updated Wallbaser
#!/usr/bin/python
import re
import argparse
from pyquery import PyQuery as Q
from lxml import etree
from base64 import b64decode
from urllib2 import urlopen
def main():
@LeoAdamek
LeoAdamek / php.conf
Created July 7, 2013 14:49
php.conf
;;
;; Configuration for:
;; * leo.adamek.me
;;
[leo.adamek.me]
pid = /run/php/leo.adamek.me.pid
error_log = /home/leo/logs/leo.adamek.me.error.log
daemonize = yes
@LeoAdamek
LeoAdamek / STDOUT
Created July 7, 2013 14:57
php error
14:53:57 [email protected] php php-fpm
[07-Jul-2013 14:54:09] ERROR: [/etc/php/fpm.d/leo.adamek.me.conf:6] unknown entry 'pid'
[07-Jul-2013 14:54:09] ERROR: Unable to include /etc/php/fpm.d/leo.adamek.me.conf from /etc/php/php-fpm.conf at line 6
[07-Jul-2013 14:54:09] ERROR: failed to load configuration file '/etc/php/php-fpm.conf'
[07-Jul-2013 14:54:09] ERROR: FPM initialization failed
@LeoAdamek
LeoAdamek / gist:6210246
Created August 12, 2013 11:56
SOLR Error
Error CREATEing SolrCore 'new_core': Unable to create core: new_core Caused by: Can't find resource 'schema.xml' in classpath or '/home/dev/development/solr/solr44/new_core/conf/', cwd=/var/lib/tomcat6
@LeoAdamek
LeoAdamek / Syslogd Output
Created August 22, 2013 22:01
OpenVPN Stuff
Aug 22 22:51:10 HomeRouter openvpn: OpenVPN 2.2.1 mips-linux [SSL] [LZO2] [EPOLL] built on Sep 27 2012
Aug 22 22:51:10 HomeRouter openvpn: NOTE: OpenVPN 2.1 requires '--script-security 2' or higher to call user-defined scripts or executables
Aug 22 22:51:10 HomeRouter openvpn: Note: cannot open openvpn-status.log for WRITE
Aug 22 22:51:10 HomeRouter openvpn: Diffie-Hellman initialized with 1024 bit key
Aug 22 22:51:10 HomeRouter openvpn: LZO compression initialized
Aug 22 22:51:10 HomeRouter openvpn: Control Channel MTU parms [ L:1544 D:140 EF:40 EB:0 ET:0 EL:0 ]
Aug 22 22:51:10 HomeRouter openvpn: Socket Buffers: R=[87380->131072] S=[16384->131072]
Aug 22 22:51:10 HomeRouter openvpn: TUN/TAP device tun0 opened
Aug 22 22:51:10 HomeRouter openvpn: TUN/TAP TX queue length set to 100
Aug 22 22:51:10 HomeRouter openvpn: WARNING: External program may not be called unless '--script-security 2' or higher is enabled. Use '--script-security 3 system' for backward compatibility with 2.1_rc8 and earlier. See --help tex
@LeoAdamek
LeoAdamek / cpuinfo
Created September 20, 2013 20:55
/proc/cpuinfo on a score from eBay
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 15
model name : Intel(R) Xeon(R) CPU E5310 @ 1.60GHz
stepping : 7
microcode : 0x67
cpu MHz : 1596.049
cache size : 4096 KB
physical id : 0
class OrganizationsController < ApplicationController
before_filter :authenticate_user! , except: [:index , :show]
def index
@organizations = Organization.all
end
def show
@organization = Organization.friendly.find(params[:id])