Skip to content

Instantly share code, notes, and snippets.

@hizel
hizel / patch-showsys.c
Last active August 29, 2015 13:57
sysutils/atop/files/patch-showsys.c
--- showsys.c.orig 2014-03-28 17:03:26.000000000 +0400
+++ showsys.c 2014-03-28 17:03:08.000000000 +0400
@@ -1624,9 +1624,14 @@
count_t ival = sstat->intf.intf[as->index].rbyte/125/as->nsecs;
count_t oval = sstat->intf.intf[as->index].sbyte/125/as->nsecs;
+
static char buf[16]="ethxxxx ----";
// 012345678901
@hizel
hizel / Linux-3.11.patch
Created September 5, 2013 09:03
app-emulation/virtualbox-4.2.16 + linux 3.11 patch
--- a/vboxnetflt/linux/VBoxNetFlt-linux.c
+++ b/vboxnetflt/linux/VBoxNetFlt-linux.c
@@ -1805,5 +1805,9 @@
{
PVBOXNETFLTINS pThis = VBOX_FLT_NB_TO_INST(self);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0)
+ struct net_device *pDev = netdev_notifier_info_to_dev(ptr);
+#else
struct net_device *pDev = (struct net_device *)ptr;
+#endif
@hizel
hizel / moveThemes.groovy
Created December 16, 2011 11:40
move themes from profile to db
import groovy.sql.Sql
int count = 0;
int icount = 0;
String storagePath = "/home/hizel/dev/lorsource/target/tmp/linux-storage/profile";
def sql = Sql.newInstance("jdbc:postgresql://127.0.0.1:5432/lor", "linuxweb", "linuxweb", "org.postgresql.Driver")
new File(storagePath).eachFile { file ->
new File(file.canonicalPath).withObjectInputStream { instream ->
instream.eachObject {
if(it.get("style") != null && it.get("style") != "tango") {
println "set style for " + file.name + " to " + it.get("style")
@hizel
hizel / lor-jamwiki-upgrade-1.0.4-1.1.sql
Created September 13, 2011 20:48
upgrade jamwiki db 1.0.4 -> 1.1
-- a
alter table jam_log add column log_sub_type INTEGER;
alter table jam_recent_change add column log_sub_type INTEGER;
-- b
update jam_log set log_sub_type = 11 where log_type = 1 and log_params like '%|7';
update jam_log set log_sub_type = 10 where log_type = 1 and log_params not like '%|7';
update jam_recent_change set log_sub_type = 11 where log_type = 1 and log_params like '%|7';
update jam_recent_change set log_sub_type = 10 where log_type = 1 and log_params not like '%|7';
-- c
CREATE TABLE jam_user_block (
@hizel
hizel / fix-delete.sql
Created June 28, 2011 07:33
fix delete trigger
--
-- Name: msgdel(); Type: FUNCTION; Schema: public; Owner: maxcom
--
CREATE OR REPLACE FUNCTION msgdel() RETURNS trigger
LANGUAGE plpgsql
AS $$
DECLARE
grid int;
stat_1 int;
@hizel
hizel / lor-jamwiki-upgrade-0.9.5-1.0.4.sql
Created June 22, 2011 11:24
sql for upgrade jamwiki from 0.9.5 to 1.0.4
-- Create the jam_topic_links table.
CREATE TABLE jam_topic_links (
topic_id INTEGER NOT NULL,
link_topic_name VARCHAR(200) NOT NULL,
CONSTRAINT jam_p_topic_links PRIMARY KEY (topic_id, link_topic_name),
CONSTRAINT jam_f_tlink_topic_id FOREIGN KEY (topic_id) REFERENCES jam_topic(topic_id)
);
-- Create the jam_interwiki table.
@hizel
hizel / gist:705059
Created November 18, 2010 14:43
solr rulez
<?xml version="1.0" encoding="UTF-8" ?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
CREATE TABLE jam_namespace (
namespace_id INTEGER NOT NULL,
namespace VARCHAR(200) NOT NULL,
main_namespace_id INTEGER,
CONSTRAINT jam_p_namesp PRIMARY KEY (namespace_id),
CONSTRAINT jam_u_namesp_namesp UNIQUE (namespace),
CONSTRAINT jam_f_namesp_namesp FOREIGN KEY (main_namespace_id) REFERENCES jam_namespace(namespace_id)
);
ALTER TABLE jam_namespace OWNER TO maxcom;
@hizel
hizel / gist:633686
Created October 19, 2010 05:48
role fix
drop table jam_authorities;
create view jam_authorities as
select nick as username, 'ROLE_ADMIN' as authority from users where canmod='t'
union
select nick as username, 'ROLE_SYSADMIN' as authority from users where id=1
union
select nick as username, 'ROLE_EDIT_EXISTING' as authority from users where not users.blocked AND users.score >= 50
union