Skip to content

Instantly share code, notes, and snippets.

View meetps's full-sized avatar
IDDQD

Meet Shah meetps

IDDQD
View GitHub Profile
@Prithvirajbilla
Prithvirajbilla / getfeed.php
Created October 27, 2014 12:45
Get feed From URL with Basic Authorisation
<?php
function getfromweb($url, $username = null, $password = null) {
$opts = array('http' =>
array(
'method' => 'GET',
'header' => "Authorization: Basic ".base64_encode("$username:$password")."\r\n")
);
$context = stream_context_create($opts);
$result = file_get_contents($url, false, $context);
return $result;
@ericdouglas
ericdouglas / super-tip.txt
Last active October 6, 2024 18:28
Change 4 spaces to 2 spaces indentation and change tab to spaces - Vim tip
// 4 spaces to 2 spaces
%s;^\(\s\+\);\=repeat(' ', len(submatch(0))/2);g
// Tab to 2 spaces
:%s/\t/ /g
@Lazza
Lazza / README.md
Last active October 16, 2024 08:17
VPNGate Python script

This script is NOT MAINTAINED

This snippet of code was posted in 2014 and slightly revised in 2016 and 2017. It was more of a quick'n'dirty script than a polished tool. It is made only for Linux and in Python 2, which has since become outdated.

I currently do not use it, and I suggest you avoid it as well. Please do not expect support for using this script.

🔥 If you need an alternative, @glaucocustodio has kindly suggested EasyVPN in this comment.

The rest of the README is left for historical purposed.

@ranveeraggarwal
ranveeraggarwal / iitb-ldap-auth.php
Created July 18, 2014 17:13
IITB LDAP Auth Script (PHP)
<?php
function ldap_auth($ldap_id, $ldap_password){
$ds = ldap_connect("ldap.iitb.ac.in") or die("Unable to connect to LDAP server. Please try again later.");
if($ldap_id=='') die("You have not entered any LDAP ID. Please go back and fill it up.");
if($ldap_password=='') die("You have not entered any password. Please go back and fill it up.");
$sr = ldap_search($ds,"dc=iitb,dc=ac,dc=in","(uid=$ldap_id)");
$info = ldap_get_entries($ds, $sr);
$roll = $info[0]["employeenumber"][0];
//print_r($info);
$ldap_id = $info[0]['dn'];
@tsl0922
tsl0922 / .tmux.conf
Last active March 24, 2025 02:15
vim style tmux config
# vim style tmux config
# use C-a, since it's on the home row and easier to hit than C-b
set-option -g prefix C-a
unbind-key C-a
bind-key C-a send-prefix
set -g base-index 1
# Easy config reload
bind-key R source-file ~/.tmux.conf \; display-message "tmux.conf reloaded."
@tsiege
tsiege / The Technical Interview Cheat Sheet.md
Last active April 26, 2025 08:09
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.

ANNOUNCEMENT

I have moved this over to the Tech Interview Cheat Sheet Repo and has been expanded and even has code challenges you can run and practice against!






\

@vitorbritto
vitorbritto / vim.md
Last active January 20, 2023 09:26
Vim Commands Cheat Sheet

Vim Commands Cheat Sheet

How to Exit

Command Description
:q[uit] Quit Vim. This fails when changes have been made.
:q[uit]! Quit without writing.
:cq[uit] Quit always, without writing.
@simonw
simonw / gist:7000493
Created October 15, 2013 23:53
How to use custom Python JSON serializers and deserializers to automatically roundtrip complex types.
import json, datetime
class RoundTripEncoder(json.JSONEncoder):
DATE_FORMAT = "%Y-%m-%d"
TIME_FORMAT = "%H:%M:%S"
def default(self, obj):
if isinstance(obj, datetime.datetime):
return {
"_type": "datetime",
"value": obj.strftime("%s %s" % (
@iambibhas
iambibhas / README.md
Last active August 10, 2020 10:09
Python script to upload image to imgur from linux terminal. Must have the `sh` package installed.

This uses sh package. Install it using pip.

$ (sudo )pip install sh

Then place this script with the name imgur in some location that's in your PATH, chmod +x the file and upload like this

$ imgur ~/Pictures/Screenshot\ from\ 2013-10-06\ 20:01:32.png

@wandernauta
wandernauta / sp
Last active February 4, 2025 22:08
sp is a command-line client for Spotify's dbus interface. Play, pause, skip and search tracks from the comfort of your command line.
#!/usr/bin/env bash
#
# This is sp, the command-line Spotify controller. It talks to a running
# instance of the Spotify Linux client over dbus, providing an interface not
# unlike mpc.
#
# Put differently, it allows you to control Spotify without leaving the comfort
# of your command line, and without a custom client or Premium subscription.
#