Skip to content

Instantly share code, notes, and snippets.

@ninadsp
ninadsp / step-1.sh
Created July 28, 2013 12:37
Code snippets for my blogpost on moving MySQL's data directory (http://ninad.pundaliks.in/blog/2011/11/mysql-moving-datadir/ )
sudo service mysql stop
@ninadsp
ninadsp / screen_ssh.sh
Last active December 20, 2015 08:09
Code snippets for my blogpost to show hostname and username during ssh in screen/byobu's title (http://ninad.pundaliks.in/blog/2011/10/show-hostname-and-username-during-ssh-in-screen-or-byobus-window-title/)
#!/bin/bash
# screen_ssh.sh by Chris Jones
# Modified by Ninad Pundalik
# Released under the GNU GPL v2 licence.
# Set the title of the current screen to the username and hostname being ssh'd to
#
# usage: screen_ssh.sh $PPID hostname username
#
# This is intended to be called by ssh(1) as a LocalCommand.
# For example, put this in ~/.ssh/config:
@ninadsp
ninadsp / FixZipArchive.php
Last active February 17, 2021 16:52
Code snippets for my blogpost Recursively Zip a directory with PHP (http://ninad.pundaliks.in/blog/2011/05/recursively-zip-a-directory-with-php/)
<?
/**
* FlxZipArchive, Extends ZipArchiv.
* Add Dirs with Files and Subdirs.
*
* <code>
* $archive = new FlxZipArchive;
* // .....
* $archive->addDir( 'test/blub', 'blub' );
* </code>
@ninadsp
ninadsp / 1.sh
Created July 28, 2013 14:33
Code snippets from my blogpost Upgrading to Lucid at the BITS Network (http://ninad.pundaliks.in/blog/2010/05/upgrading-to-lucid-at-the-bits-network/)
~ $ : export http_proxy="http://bitsfoss:3142/"
@ninadsp
ninadsp / twitter_ajax.php
Created July 28, 2013 14:45
Code snippet from my blogpost How to Tweet using PHP (http://ninad.pundaliks.in/blog/2009/08/how-to-tweet-using-your-own-php-script-2/). Deprecated code, depended on Twitter API v1 and Basic Authentication. Will not work anymore
<?php
if($_REQUEST['ajax_req']== true)
{
//Process the tweet
$username = $_REQUEST['username'];
$password = $_REQUEST['password'];
$status = $_REQUEST['status'];
$auth_string = $username.":".$password;
$postdata = array('status' => $status );
$options = array(
@ninadsp
ninadsp / 1.sh
Created July 28, 2013 14:52
Code snippets from my blogpost LG LXU800 Dialer on Ubuntu Jaunty (http://ninad.pundaliks.in/blog/2009/05/lg-lxu800-dialer-on-ubuntu-jaunty/)
: ~ $ sudo modprobe usbserial vendor='0xeab' product='0x9357'
@ninadsp
ninadsp / im_1.sh
Created July 28, 2013 15:12
Code snippets from my blogpost ACAD - ImageMagick again! (http://ninad.pundaliks.in/blog/2008/12/acad-imagemagick-again/)
#!/bin/bash# Timepass script to experiment with imagemagick
for x in 0 1 2 3 4 5 6
do
convert -size 100x100 plasma:fractal -font Helvetica-Bold -pointsize 90 -tile gradient:white-gray -stroke white -annotate +26+78 $x $x.jpg;
echo -e "$x.jpg generated\n";
@ninadsp
ninadsp / 1.sh
Created July 28, 2013 15:35
Code snippets from my blogpost ACAD - wget
$ wget http://address.of/your.file
@ninadsp
ninadsp / 1.sh
Last active November 4, 2017 12:46
Code snippets from my blog (http://ninad.pundaliks.in/blog)
$: echo -e "\ahi \nsent by user" > /dev/tty1
@ninadsp
ninadsp / 1.sh
Created July 28, 2013 15:56
Code snippets from my blogpost ACAD - locate files on your Linux system (http://ninad.pundaliks.in/blog/2008/08/acad-locate-files-on-your-linux-system/)
$ locate [expression]