Skip to content

Instantly share code, notes, and snippets.

View shivampip's full-sized avatar
🏡
In Quarantine

Shivam Agrawal shivampip

🏡
In Quarantine
View GitHub Profile
@nathania
nathania / git_from_python_script.py
Created May 31, 2012 01:33
Execute git command from Python script
from subprocess import Popen, PIPE
from os import path
git_command = ['/usr/bin/git', 'status']
repository = path.dirname('/path/to/dir/')
git_query = Popen(git_command, cwd=repository, stdout=PIPE, stderr=PIPE)
(git_status, error) = git_query.communicate()
if git_query.poll() == 0:
# Do stuff
@Druid-of-Luhn
Druid-of-Luhn / cloth-bg.css
Created August 27, 2012 17:21
Grungy cloth texture CSS background
.cloth-bg {
background: #777;
background: -webkit-radial-gradient(rgba(0, 0, 0, 0.1) 50%, rgba(255, 255, 255, 0.1) 50%),
-webkit-linear-gradient(45deg, rgba(50, 50, 50, 0.95), rgba(200, 200, 200, 0.95)),
url('http://f.cl.ly/items/3h0j172n2i3q1z0t2G1P/noise.jpg');
background-size: 3px 3px,
auto auto,
auto auto;
}
@72lions
72lions / concat.array.buffers.js
Created January 14, 2013 09:22
Concatenates two ArrayBuffers
/**
* Creates a new Uint8Array based on two different ArrayBuffers
*
* @private
* @param {ArrayBuffers} buffer1 The first buffer.
* @param {ArrayBuffers} buffer2 The second buffer.
* @return {ArrayBuffers} The new ArrayBuffer created out of the two.
*/
var _appendBuffer = function(buffer1, buffer2) {
var tmp = new Uint8Array(buffer1.byteLength + buffer2.byteLength);
@techniq
techniq / audit_mixin.py
Created March 16, 2013 01:05
Useful SQLAlchemy Mixins
from datetime import datetime
from sqlalchemy import Column, Integer, DateTime, ForeignKey
from sqlalchemy.orm import relationship
from sqlalchemy.ext.declarative import declared_attr
from flask_security import current_user
class AuditMixin(object):
created_at = Column(DateTime, default=datetime.now)
updated_at = Column(DateTime, default=datetime.now, onupdate=datetime.now)
@sloria
sloria / bobp-python.md
Last active May 1, 2024 08:37
A "Best of the Best Practices" (BOBP) guide to developing in Python.

The Best of the Best Practices (BOBP) Guide for Python

A "Best of the Best Practices" (BOBP) guide to developing in Python.

In General

Values

  • "Build tools for others that you want to be built for you." - Kenneth Reitz
  • "Simplicity is alway better than functionality." - Pieter Hintjens
@vladimirtsyupko
vladimirtsyupko / gist:10964772
Created April 17, 2014 08:32
Git force pull to overwrite local files
git fetch --all
git reset --hard origin/master
git pull origin master
@PurpleBooth
PurpleBooth / README-Template.md
Last active May 6, 2024 07:22
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@phosphoer
phosphoer / SimpleGeo.cs
Last active March 28, 2024 22:24
Simple Geometry Painter for Unity
// The MIT License (MIT)
// Copyright (c) 2016 David Evans @phosphoer
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
@nmstoker
nmstoker / convert.py
Created January 11, 2018 00:07
Convert a Rasa NLU training file from JSON to Markdown format
from rasa_nlu.converters import load_data
# This re-uses the Rasa NLU converters code to turn a JSON Rasa NLU training
# file into MD format and save it
# Assumes you have Rasa NLU installed :-)
# If you want other options, look at the NLU code to work out how to handle them
# USE AT YOUR OWN RISK
@bradtraversy
bradtraversy / myscript.sh
Last active May 2, 2024 13:59
Basic Shell Scripting
#! /bin/bash
# ECHO COMMAND
# echo Hello World!
# VARIABLES
# Uppercase by convention
# Letters, numbers, underscores
NAME="Bob"
# echo "My name is $NAME"