Skip to content

Instantly share code, notes, and snippets.

View hvardhanx's full-sized avatar
🦄
Whattttttt up!?

Harsh Vardhan hvardhanx

🦄
Whattttttt up!?
View GitHub Profile

Binary data to SQL

pg_restore db.bin > db.sql

Log in to postgres

sudo -u postgres -i

Import from .sql file into Postgresql

psql -U postgres -W -d "valuevest" -f vv.sql -h localhost

Export a column to CSV:

@hvardhanx
hvardhanx / monster_grpc_fb.py
Created October 28, 2017 16:37
Generated by the gRPC Python protocol compiler plugin. Some edits were made by hand to make it work with flatbuffers. (:
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
import grpc
import flatbuffers
import MyGame.Sample.Monster as Monster
import MyGame.Sample.Weapon as Weapon
builder = flatbuffers.Builder(0)
class MonsterStorageStub(object):
@hvardhanx
hvardhanx / builder.py
Created October 28, 2017 16:35
Serializers + Deserializers
from . import encode
from . import packer
+import pickle
from . import compat
from .compat import range_func
@@ -391,6 +392,14 @@ class Builder(object):
self.PlaceUOffsetT(vectorNumElems)
return self.Offset()
@hvardhanx
hvardhanx / grpctest.py
Created October 28, 2017 16:32
gRPC + Flatbuffers
from __future__ import print_function
import os
import sys
from concurrent import futures
import time
import grpc
import flatbuffers
import MyGame.Sample.Color as Color
! #if __has_include(".extend.Xresources")
! #include ".extend.Xresources"
! #endif
! ^ The above lines are no comments!
! Leave them as they are if a file ~/.extend.Xresources is being used on your system.
! config can be added there or also here below.
! For comments use "!"
! Xft.dpi: 96
#!/usr/bin/env bash
icon="$HOME/Pictures/lock.png"
tmpbg='/tmp/screen.png'
(( $# )) && { icon=$1; }
scrot "$tmpbg"
convert "$tmpbg" -scale 10% -scale 1000% "$tmpbg"
convert "$tmpbg" "$icon" -gravity center -composite -matte "$tmpbg"
#!/bin/bash
osd='no'
inc='5'
capvol='no'
maxvol='200'
tmpfile='/tmp/pasink.tmp'
autosync='yes'
active_sink=`pacmd list-sinks |awk '/* index:/{print $3}'`
#!/bin/bash
killall -q polybar
while pgrep -x polybar >/dev/null; do sleep 1; done
polybar -r top
@hvardhanx
hvardhanx / zshrc
Last active August 29, 2017 06:40
# If you come from bash you might have to change your $PATH.
export PATH=$HOME/flatbuffers:$HOME/.local/bin:/usr/local/mysql/bin:/opt/android-studio/bin:$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH=/home/hvardhan/.oh-my-zsh
# Set name of the theme to load. Optionally, if you set this to "random"
# it'll load a random theme each time that oh-my-zsh is loaded.
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
ZSH_THEME="af-magic"
$ rvm install 2.3.1
Searching for binary rubies, this might take some time.
No binary rubies available for: manjaro/17.0.2/x86_64/ruby-2.3.1.
Continuing with compilation. Please read 'rvm help mount' to get more informatio
Checking requirements for manjaro.
Requirements installation successful.
Installing Ruby from source to: /home/hvardhan/.rvm/rubies/ruby-2.3.1, this may 
ruby-2.3.1 - #downloading ruby-2.3.1, this may take a while depending on your co
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current