Skip to content

Instantly share code, notes, and snippets.

View miss-invincible's full-sized avatar
🤗
less is more

shivangi miss-invincible

🤗
less is more
View GitHub Profile
import java.awt.*;
import javax.swing.*;
import javax.sound.midi.*;
import java.util.*;
import java.awt.event.*;
public class BeatBox2
{
JPanel mainPanel;
ArrayList<JCheckBox> checkboxList;
this file contains python socket programing and many other codes.
import socket
import sys
# Create a TCP/IP socket
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
# Bind the socket to the port
server_address = ('localhost', 10000)
print >>sys.stderr, 'starting up on %s port %s' % server_address
@miss-invincible
miss-invincible / php_mysql.php
Created June 11, 2016 20:50
this code setsup PDO connection of php with mysql. for running it use command :
<?php
$servername='localhost';
$username='root';
$password='password';
try {
$conn = new PDO("mysql:host=$servername;dbname=testdb1", $username, $password);
// set the PDO error mode to exception
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
echo "Connected successfully";
@miss-invincible
miss-invincible / git1.md
Last active February 27, 2017 15:48
when u commit and then realize that yo have not pulled from remote.Follow these steps to avoid adding an extra merge commit to your branch and keep the commits clean.

Say the branch in which you were working was : master

git add -A
git commit -m "added few changes"
commit hash = 5e108f2

you added your work and then committed it. But then realised you forgot to pull.Now:
git checkout -b newtry master
// git checkout newtry -->optional : try without this

@miss-invincible
miss-invincible / bash_profile
Created April 20, 2017 00:14
to make ~/bashrc file run automatically on each terminal start
open .bash_profile file (vim ~/.bash_profile)
add this ->
[[ -s ~/.bashrc ]] && source ~/.bashrc
@miss-invincible
miss-invincible / uncommit.md
Last active April 22, 2017 09:24
This file contains method to uncommit files and message and simply uncommit a message

to uncommit all the stuff: both the message and added files:
git reset HEAD~

in this case you would have to add files and add message before making commit.(changed and added files(staged) are unstaged).

if just just want to edit message of the commit then use soft HEAD:
git reset --soft HEAD~

to reset to a particlar commit :
git reset --hard 4a155e5

@miss-invincible
miss-invincible / file_revert.md
Created April 23, 2017 17:59
revert changes of a single file in git

if you wish to revert the changes of a single file use this command (when you file name does not match with any of the branch names):
git checkout filename

if your file name is similar to any of your branch names the use this command:
git checkout -- filename

@miss-invincible
miss-invincible / log.md
Created April 25, 2017 12:04
log the commits

to see the log of git commits :
git log branchname

to change a commit messsage:(not tested this)
git commit --amend

1) install python3 (numpy has one dependency which needs python3.4 so it is better to install python3)
2) install pip python3:
sudo apt install python3-pip
3) install sklearn:
pip3 install -U scikit-learn
4) test on python if it is successfully installed:
python3
from sklearn.cluster import KMeans
if everything is imported successfully then its cool, else it will ask to install python numpy
5) install python numpy