Skip to content

Instantly share code, notes, and snippets.

View ajin's full-sized avatar

ajin

  • country located in Northwestern Europe with overseas territories in the Caribbean
View GitHub Profile
@ajin
ajin / Push.js
Last active August 29, 2015 14:07
The post method in Push.js
/* ========================================================================
* Ratchet: push.js v2.0.2
* http://goratchet.com/components#push
* ========================================================================
* inspired by @defunkt's jquery.pjax.js
* Copyright 2014 Connor Sears
* Licensed under MIT (https://github.com/twbs/ratchet/blob/master/LICENSE)
* ======================================================================== */
/* global _gaq: true */
@ajin
ajin / unlock_unexpire_users.sql
Created November 15, 2015 22:24
SQL statement to unlock and unexpire Oracle users
select 'alter user "'||username||'" account unlock;' || chr(10) ||
'alter user "'||username||'" identified by values ''temp'';' || chr(10) ||
'alter user "'||username||'" identified by values '''||extract(xmltype(dbms_metadata.get_xml('USER',username)),'//USER_T/PASSWORD/text()').getStringVal()||''';' old_password
from dba_users
where account_status != 'OPEN';
@ajin
ajin / default-oracle-trigger-insert-update.sql
Created May 7, 2016 19:53
Default Oracle trigger for insert and update statement
create or replace TRIGGER "BIU_<TABLE_NAME>"
before insert or update on "<TABLE_NAME>"
for each row
begin
if inserting and :new.id is null then
select "<TABLE_NAME>_ID_SEQ".nextval into :NEW."ID" from sys.dual;
end if;
if inserting then
:new.created_by := nvl(apex_application.g_user,USER);
declare
l_access_granted number := 0;
l_status varchar2(10);
l_message varchar2(254);
l_mac varchar2(254);
l_key varchar2(254);
begin
l_mac := :muid;
l_key := :kuid;
@ajin
ajin / vpn-heartbeat.sh
Last active June 5, 2017 16:29
Reconnecting a failed VPN connection on Synology by Ian Harrier
#!/bin/bash
## Reconnect Synology VPN
## Written by Ian Harrier
## Based on https://forum.synology.com/enu/viewtopic.php?f=241&t=65444
## From: https://blog.harrier.us/reconnecting-a-failed-vpn-connection-on-synology-dsm-6/
###
# Process config files
###
@ajin
ajin / 389-ds-install-rhel7
Last active August 19, 2017 21:26
Installing 389 Directory Server on RHEL 7.4 with workaround conflicts
wget http://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-7
wget https://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-10.noarch.rpm
rpm --import RPM-GPG-KEY-EPEL-7
yum localinstall epel-release-7-10.noarch.rpm
yum install 389-ds-base 389-admin
yum install ldapjdk
wget https://dl.fedoraproject.org/pub/epel/7/x86_64/i/idm-console-framework-1.1.17-1.el7.noarch.rpm
@ajin
ajin / smtp-acl-oracle-apex.sql
Created February 1, 2016 20:21
Setting up ACL for sending email on Oracle APEX 5
begin
dbms_network_acl_admin.create_acl (
acl => 'smtp-permissions.xml',
description => 'Permissions for smtp',
principal => 'APEX_050000',
is_grant => true,
privilege => 'connect');
commit;
end;
/
yum install syslog-ng
systemctl enable syslog-ng
systemctl start syslog-ng
yum erase rsyslog
systemctl restart syslog-ng
netstat -antup | grep 514
dn: cn=john,ou=People,dc=lab,dc=savarize,dc=net
objectClass: top
objectClass: person
objectClass: organizationalPerson
objectClass: inetOrgPerson
objectClass: posixAccount
objectClass: shadowAccount
uid: spfaff
uidNumber: 1000
gidNumber: 100
@ajin
ajin / create_rsyslog_homebridge.sh
Created November 29, 2020 19:31
Setup homebridge.log with rsyslog
# this will create a conf for rsyslog to generate logs to homebridge.log
cat > /etc/rsyslog.d/homebridge.conf << EOF
if $programname == 'homebridge' then {
action(type="omfile" file="/var/log/homebridge.log")
stop
}
EOF
systemctl restart rsyslog