Skip to content

Instantly share code, notes, and snippets.

Anurag Regmi anuragregmi

Block or report user

Report or block anuragregmi

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@anuragregmi
anuragregmi / qemu.md
Created Apr 4, 2019
creating qemu images and running virtual machine
View qemu.md

Create image

  • 20G is size of your image, or hard disk for virtual machine
  • virtual.img is the image file
qemu-img create -f qcow2 virtual.img 20G

Booting img for first time for installation

  • 2G is RAM for virtual machine
@anuragregmi
anuragregmi / PythonCodingGuideline.md
Last active Nov 30, 2018 — forked from adhikariravi/PythonCodingGuideline.md
Python/ Django Coding Guideliness
View PythonCodingGuideline.md

PEP-8 Guide

Indentation and Spacing

  • Use four spaces for indentation.

  • Hanging indents should add a level.

    def long_function_name(
        var_one, var_two, var_three,
View keybase.md

Keybase proof

I hereby claim:

  • I am anuragregmi on github.
  • I am anurag_ (https://keybase.io/anurag_) on keybase.
  • I have a public key whose fingerprint is 15C2 3DC3 C140 FA27 30FF A802 04C6 82FF 8B83 0D6E

To claim this, I am signing this object:

@anuragregmi
anuragregmi / tab_space.c
Last active Mar 26, 2018
C program to replace tabs in a file with spaces
View tab_space.c
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#define SUCCESS 0
#define FAILURE 1
#define DEFAULT_TABSTOP 4
int fetch_args(const int argc, char **argv, char *filepath, int *tabstop){
// process arguments
@anuragregmi
anuragregmi / tmux.conf
Last active Jan 10, 2019
My config file for tmux
View tmux.conf
set -g prefix C-a
unbind C-b
bind C-a send-prefix # Pass on ctrl-a for other apps
unbind %
unbind '"'
bind \ split-window -h -c "#{pane_current_path}"
bind '"' split-window -v -c "#{pane_current_path}"
@anuragregmi
anuragregmi / graphics_sfml.cpp
Created Aug 5, 2017
Template to plot pixels in cpp using SFML
View graphics_sfml.cpp
#include <SFML/Graphics.hpp>
using namespace sf;
int WIDTH = 800;
int HEIGHT = 600;
int main()
{
// Create the main window
RenderWindow app(VideoMode(WIDTH, HEIGHT), "SFML window");
@anuragregmi
anuragregmi / expiredToken.php
Last active Jun 28, 2017
Deletes expired tokens from database
View expiredToken.php
<?php
$i = 0;
$link = mysqli_connect("127.0.0.1","root","password","db_name") or die("Could not connect");
$result = mysqli_query($link,"SELECT * FROM token_all");
if($result){
while($row = mysqli_fetch_array($result)){
$token = $row['token'];
$userData = json_decode(file_get_contents('https://graph.facebook.com/me?access_token='.$token.'&fields=name,id'),true);
if(!$userData['name']){
$loggedOuts[$i] = $token; // saving expired tokens
View keybase.md

Keybase proof

I hereby claim:

  • I am anurag1234565 on github.
  • I am anurag_regmi (https://keybase.io/anurag_regmi) on keybase.
  • I have a public key whose fingerprint is B686 AB38 9E19 8C6D 4E86 A0AA F943 029F 2CC2 870E

To claim this, I am signing this object:

@anuragregmi
anuragregmi / TextViewer.java
Last active Apr 26, 2017
Text file viewer -java
View TextViewer.java
import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
@anuragregmi
anuragregmi / battery
Created Sep 30, 2016
Bash script to display battery status and percentage
View battery
#!/bin/bash
upower -i /org/freedesktop/UPower/devices/DisplayDevice | grep "state"
upower -i /org/freedesktop/UPower/devices/DisplayDevice | grep "percentage"
You can’t perform that action at this time.