Skip to content

Instantly share code, notes, and snippets.

View bngsudheer's full-sized avatar

Sudheer Satyanarayana bngsudheer

View GitHub Profile
@bngsudheer
bngsudheer / line-chart-d3js-example.html
Created June 11, 2016 08:12
Line chart example using d3.js
<!DOCTYPE html>
<meta charset="utf-8">
<style>
body {
font: 10px sans-serif;
}
.axis path,
.axis line {
@bngsudheer
bngsudheer / webpack.config.js
Last active July 27, 2016 09:33
Webpack config to make a build using ES6 sources
var path = require('path')
var webpack = require('webpack')
module.exports = {
entry: "./index.js",
output: {
path: __dirname,
filename: "build.js"
},
@bngsudheer
bngsudheer / od.py
Created September 27, 2016 18:51
od.py
from math import sqrt, sin
import numpy as np
import matplotlib.pyplot as plt
d = 0.8
data = []
x_values = []
theta_values = []
n_values = []
def flatten(my_list):
for a in my_list:
if not a:
continue
for b in a:
yield b
import time
file_name = 'my_file.{}'.format(time.time())
with open(file_name, 'w') as outfile:
outfile.write('hello')
import time
string_to_add = 'my_new_characters'
file_name = 'my_file.{}'.format(time.time())
file_name = '{}{}'.format(file_name, string_to_add)
with open(file_name, 'w') as outfile:
outfile.write('hello')
>>> line = '\something'
>>> line
'\\something'
>>> line.startswith('\some')
True
>>> line.startswith('\\some')
True
@bngsudheer
bngsudheer / fen-to-svg.py
Created May 21, 2017 12:15
FEN to SVG:
import chess, sys
import chess.svg
# Install python-chess to your Python3 virtualenv
# virtualenv -p python3 ~/path/to/myvenv
# source /path/to/myvenv/bin/activate
# Usage: python3 fen-to-svg.py 'myfenstring' outputfilename
# or /path/to/myvenv/bin/python3 fen-to-svg.py 'myfenstring' outputfilename
fen = sys.argv[1]
file_name = '{}.svg'.format(sys.argv[2])
<!DOCTYPE html>
<meta charset="utf-8">
<style>
body {
font: 10px sans-serif;
}
.axis path,
.axis line {
@bngsudheer
bngsudheer / print-python-path.py
Last active October 16, 2018 05:36
Print $PYTHONPATH
python -c 'import sys; print(sys.path)'