Skip to content

Instantly share code, notes, and snippets.

@intika
intika / Force-Inet4-Or-Inet6.c
Last active February 1, 2019 04:08 — forked from winny-/force-inet4-or-inet6.c
Force IPv4 or IPv6 in applications such as Lynx
/*
force-inet4-or-inet6.c - hack to force applications to use IPv4 or IPv6 exclusively
compilation: cc -fPIC -shared -DUSE_INET4 -o force-inet4.so force-inet4-or-inet6.c
cc -fPIC -shared -DUSE_INET6 -o force-inet6.so force-inet4-or-inet6.c
usage: LD_PRELOAD=/path/to/library.so program args ...
This file is in the public domain.
*/
@intika
intika / Thunderbird-Composetab-3.diff
Last active February 1, 2019 04:10 — forked from liamzebedee/gist:5055929
Thunderbird-Composetab-3
diff -r a49f5ca048d9 calendar/base/content/dialogs/calendar-event-dialog.js
--- a/calendar/base/content/dialogs/calendar-event-dialog.js Sat Jan 12 11:37:57 2013 -0500
+++ b/calendar/base/content/dialogs/calendar-event-dialog.js Thu Feb 28 20:57:59 2013 +1000
@@ -6,6 +6,7 @@
Components.utils.import("resource://gre/modules/Services.jsm");
Components.utils.import("resource://calendar/modules/calRecurrenceUtils.jsm");
Components.utils.import("resource:///modules/mailServices.js");
+Components.utils.import("chrome://messenger/content/msgComposeTab.js");
try {
@intika
intika / Article-Style.css
Last active February 1, 2019 04:12 — forked from bangedorrunt/article-style.css
GoldenDict Dark Theme
body
{
margin-top: 1px;
margin-right: 3px;
margin-left: 2px;
margin-bottom: 3px;
background: #201F1F;
color: white;
font-family: Bookerly, Segoe UI, Palatino Linotype, Arial Unicode MS;
}
#!/bin/bash
# Expects Ubuntu 16.06 (xenial) and kernel 4.x.
# Based upon a blog post by Zach at http://zachzimm.com/blog/?p=191
set -eux
# Have the user call sudo early so the credentials is valid later on
sudo whoami
function loadContextAndGoodies(request, return_goodies) {
var loadContext = null;
if (request instanceof Ci.nsIRequest) {
try {
if (request.loadGroup && request.loadGroup.notificationCallbacks) {
loadContext = request.loadGroup.notificationCallbacks.getInterface(Ci.nsILoadContext);
}
} catch (ex) {
console.exception('request loadGroup with notificationCallbacks but oculd not get nsIloadContext', ex);
@intika
intika / Revert-A-Commit.md
Last active March 21, 2019 22:32 — forked from gunjanpatel/revert-a-commit.md
Git HowTo: revert a commit already pushed to a remote repository

Revert the full commit

Sometimes you may want to undo a whole commit with all changes. Instead of going through all the changes manually, you can simply tell git to revert a commit, which does not even have to be the last one. Reverting a commit means to create a new commit that undoes all changes that were made in the bad commit. Just like above, the bad commit remains there, but it no longer affects the the current master and any future commits on top of it.

git revert {commit_id}'

About History Rewriting

Delete the last commit

Deleting the last commit is the easiest case. Let's say we have a remote origin with branch master that currently points to commit dd61ab32. We want to remove the top commit. Translated to git terminology, we want to force the master branch of the origin remote repository to the parent of dd61ab32:

@intika
intika / ipvlan_l3_mode_example.md
Created May 4, 2019 20:19 — forked from nerdalert/ipvlan_l3_mode_example.md
IPVlan L3 Mode Two Host Example

Quick Paste Ipvlan L3 Instructions

  • Host #1
ip netns add ns1
ip link add link eth1 ipvl1 type ipvlan mode l3
ip link set dev ipvl1 netns ns1

ip netns exec ns1 bash
@intika
intika / SendRawEth.c
Last active June 5, 2019 01:14 — forked from austinmarton/sendRawEth.c
Send a raw Ethernet frame in Linux
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* gcc -o sendRaw -O2 SendRawEth.c
*/
#include <arpa/inet.h>
#include <linux/if_packet.h>
@intika
intika / psql-error-fix.md
Created December 1, 2019 21:05 — forked from AtulKsol/psql-error-fix.md
Solution of psql: FATAL: Peer authentication failed for user “postgres” (or any user)

psql: FATAL: Peer authentication failed for user “postgres” (or any user)

The connection failed because by default psql connects over UNIX sockets using peer authentication, that requires the current UNIX user to have the same user name as psql. So you will have to create the UNIX user postgres and then login as postgres or use sudo -u postgres psql database-name for accessing the database (and psql should not ask for a password).

If you cannot or do not want to create the UNIX user, like if you just want to connect to your database for ad hoc queries, forcing a socket connection using psql --host=localhost --dbname=database-name --username=postgres (as pointed out by @meyerson answer) will solve your immediate problem.

But if you intend to force password authentication over Unix sockets instead of the peer method, try changing the following pg_hba.conf* line:

from

@intika
intika / prosody.cfg.lua
Created January 28, 2020 19:37 — forked from flowolf/prosody.cfg.lua
Prosody Config
-- Prosody XMPP Server Configuration
--
-- Information on configuring Prosody can be found on our
-- website at http://prosody.im/doc/configure
--
-- Tip: You can check that the syntax of this file is correct
-- when you have finished by running: luac -p prosody.cfg.lua
-- If there are any errors, it will let you know what and where
-- they are, otherwise it will keep quiet.
--