Skip to content

Instantly share code, notes, and snippets.

View MrDHat's full-sized avatar
🍟

Akshay Katyal MrDHat

🍟
View GitHub Profile
@MrDHat
MrDHat / upload-to-github.sh
Created July 6, 2026 19:46
Unofficial API to upload to github
curl -s \
"https://uploads.github.com/user-attachments/assets?name=screenshot.png&content_type=image/png&repository_id=${REPO_ID}" \
-X POST \
-H "Authorization: Bearer $(gh auth token)" \
-H "Content-Type: application/octet-stream" \
-H "Accept: application/json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
--data-binary "@screenshot.png" \
| jq -r '.url'
@MrDHat
MrDHat / kerberos_setup.md
Created August 29, 2017 09:36 — forked from ashrithr/kerberos_setup.md
Set up kerberos on Redhat/CentOS 7

Installing Kerberos on Redhat 7

This installation is going to require 2 servers one acts as kerberos KDC server and the other machine is going to be client. Lets assume the FQDN's are (here cw.com is the domain name, make a note of the domain name here):

  • Kerberos KDC Server: kdc.cw.com
  • Kerberos Client: kclient.cw.com

Important: Make sure that both systems have their hostnames properly set and both systems have the hostnames and IP addresses of both systems in

var mongoose = require('mongoose');
var glob = require("glob");
var path = require('path');
mongoose.connect('mongodb://username:password@localhost/dbname');
/**
* We check if the connection is ok
@MrDHat
MrDHat / .htaccess
Created March 15, 2014 13:54
.htaccess for AngularJS projects
<ifModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !index
RewriteRule (.*) index.html [L]
</ifModule>
// Your app's root module...
angular.module('MyModule', [], function($httpProvider)
{
// Use x-www-form-urlencoded Content-Type
$httpProvider.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded;charset=utf-8';
// Override $http service's default transformRequest
$httpProvider.defaults.transformRequest = [function(data)
{
/**
@MrDHat
MrDHat / random.py
Created March 1, 2014 19:38
Random Number Generator in Python
# imports for abstract classes
from abc import ABCMeta, abstractmethod
import time
''' ==============================================================================================
Seed Classes
==============================================================================================='''
class Seed(object):
"""Abstract class for seeds"""

Preferences

{
	"caret_style": "phase",
	"dictionary": "Packages/Language - English/en_US.dic",
	"draw_white_space": "selection",
	"font-size": 12.0,
	"highlight_line": true,
	"ignored_packages":
## Firefox b2g
ENABLE_MARIONETTE=1
# Import the stock config for building the browser (Firefox)
. $topsrcdir/browser/config/mozconfig
# Define where build files should go. This places them in the directory
# "obj-ff-dbg" under the current source directory
mk_add_options MOZ_OBJDIR=../build_trunk_b2g
## .mozconfig for Firefox desktop (not b2g)
# Import the stock config for building the browser (Firefox)
. $topsrcdir/browser/config/mozconfig
# Define where build files should go. This places them in the directory
# "obj-ff-dbg" under the current source directory
mk_add_options MOZ_OBJDIR=../build_mc
# -s makes builds quieter by default
[ui]
merge = kdiff3
username = Akshay Katyal <ktyaks@gmail.com>
[diff]
# git diff is required so binary files don't break
git = 1
showfunc = True
unified = 8