Skip to content

Instantly share code, notes, and snippets.

View ishworgurung's full-sized avatar
🐧

Ishwor Gurung ishworgurung

🐧
View GitHub Profile
@ishworgurung
ishworgurung / inxi
Created November 11, 2019 07:52
inxi on Star Labs MK III
System:
Host: blitz Kernel: 5.2.21-1-MANJARO x86_64 bits: 64 Desktop: Gnome 3.34.1
Distro: Manjaro Linux
Machine:
Type: Laptop System: Star Labs product: LabTop v: N/A serial: <filter>
Mobo: Star Labs Online Limited model: Star LabTop (Mk III)
serial: <filter> UEFI: American Megatrends v: 1.0.09 date: 07/05/2019
Battery:
ID-1: BAT0 charge: 38.4 Wh condition: 46.9/45.6 Wh (103%)
CPU:

Keybase proof

I hereby claim:

  • I am ishworgurung on github.
  • I am isg (https://keybase.io/isg) on keybase.
  • I have a public key ASDvDU5Nf991msLfj_1uVnGo0ys0GzG-dNW-qRNvz34Rdgo

To claim this, I am signing this object:

@ishworgurung
ishworgurung / wl-stats.sh
Created December 6, 2017 12:10
some useful wl/wlctl commands
#!/bin/sh
# for wl (http://wiki.iopsys.se/index.php5/Wlctl)
for i in `seq 1 2`; do
for cmd in status isup rate txpwr pktq_stats mempool bs_data; do
wl -i eth$i $cmd;
done;
done
@ishworgurung
ishworgurung / main.rs
Last active September 10, 2015 08:19
Get file size [channels]
use std::sync::mpsc::{Receiver, Sender};
use std::path::PathBuf;
use std::fs::Metadata;
use std::io::Result;
use std::thread::spawn;
use std::sync::mpsc::channel;
fn worker_loop(files: Receiver<PathBuf>,
results: Sender<(PathBuf, Result<Metadata>)>) {
//println!("here");
@ishworgurung
ishworgurung / lvm2 extend.txt
Created July 7, 2012 00:43
Increase partition size using lvm2
No need to reboot!!!!1
0. df -ih / df -h on the linux guest
1. Increase your physical disk space from the hypervisor on the host machine.
2. Create a logical partition of the free space from the linux guest making sure that you write the partition table out.
$ cfdisk /dev/sdb
3. Drop back to the shell and do a partprobe to re-read the partition table so the kernel knows about the new logical partition. If new partition is not showing up, then you'll need to reboot (Debian & Ubuntu should be fine. But Fedora and CentOS has given me issue on this)
$ partprobe
4. Extend our Volume Group to include the new partition. Below we have sdb7 as the new logical partition created in step 2. Replace it for your own need.
$ vgextend <volume group name identified using vgdisplay> /dev/sdb7
@ishworgurung
ishworgurung / kevent_srv.py
Created May 24, 2012 07:15
So, how can I use kqueue/kevent on BSD/Mac using Python?
#!/usr/bin/env python
"""
Example on using Kqueue/Kevent on BSD/Mac
using Python.
The TCP server essentially echoes back the
message it receives on the client socket.
"""
__author__ = "Ishwor Gurung <ishwor@develworx.com>"
@ishworgurung
ishworgurung / epollsrv_skeleton.c
Created May 22, 2012 09:19
What the heck? How do I write high-performance evented I/O on Linux using C? Relax. Use this skeleton. Be happy :)
/*
Description:
An example / skeleton of a high-performance socket server on Linux. Feel free
to use this code to write your own evented servers.
The code is essentially a echo server that send(2) whatever it recv(2) from the
client, back to the client socket.
The code is high-performing due to the use of epoll(7) in a non-blocking mode
with edge-triggered distribution that scales well on a large set of file
@ishworgurung
ishworgurung / stbb_vs_sfbb.cxx
Created May 10, 2012 02:21
Comparison between std::transform vs. std::for_each (with boost::bind)
#include <iostream>
#include <cstring>
#include <vector>
#include <string>
#include <boost/bind.hpp>
#include <boost/ref.hpp>
#include <random>
using namespace std;
typedef std::vector<std::pair<std::string, int>> pair_vector;
@ishworgurung
ishworgurung / pyevinstallation.txt
Created April 22, 2012 21:22
Installing pyev from source on MAC OS X 10.7
1. Install build tools
- sudo fink install autoconf2.6 automake1.11
2. Checkout libev
- cvs -z3 -d :pserver:anonymous@cvs.schmorp.de/schmorpforge co libev
3. Generate configure script and a makefile
- cd libev
- autoreconf-2.68 --install --symlink --force > configure
- chmod +x configure && ./configure