Skip to content

Instantly share code, notes, and snippets.

Avatar
🥑
avoca-do-ing

अभिनाश (Avinash) hardfire

🥑
avoca-do-ing
View GitHub Profile
@hardfire
hardfire / eleventy_build.yml
Created May 18, 2020
Use this action to build an eleventy site and push to gh-pages
View eleventy_build.yml
name: Eleventy Build
on: [push]
jobs:
build_deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Build using node.ks
uses: actions/setup-node@v1
@hardfire
hardfire / db.sql
Created Jul 20, 2017
knex+bookshelf+graphql
View db.sql
/* i created the database manually, but here are the queries to create the db schema in POSTGRES */
CREATE TABLE students (id SERIAL PRIMARY KEY, name TEXT );
CREATE TABLE homeworks (id SERIAL PRIMARY KEY, student_id INT NOT NULL REFERENCES students, subject TEXT);
CREATE TABLE pages (id SERIAL PRIMARY KEY, homework_id INT NOT NULL REFERENCES homeworks, content TEXT);
@hardfire
hardfire / README.MD
Last active Dec 25, 2019
using cgroups to limit browser memory+cpu usage
View README.MD
  1. cgconfig.conf - that's where you create the control group /etc/
  2. cgrules.conf - that's where you add binaries to that specific control group /etc/
  3. cgconf - that's the init script i use because its not available on ubuntu. It might be available for your OS in the package manager. I took the startup script from http://askubuntu.com/questions/836469/install-cgconfig-in-ubuntu-16-04 - /etc/init.d/

Notes

Use the following steps to test what you have without the

  • cgconfigparser -l /etc/cgconfig.conf - to add/register your control group to the system
  • cgrulesengd - sends the binary-cgroup binding rules.
@hardfire
hardfire / .bashrc
Created Apr 9, 2017
HOWTO: autocompletion in a bash function/alias
View .bashrc
# I have a function called as shocker which 'sh-es' into a docker container
# to enable autocompletion in the command, I do the following
# `complete -F __docker_complete_container_names shocker`
# __docker_complete_container_names is a function available in /etc/bash_completion.d/docker
# the above file is available at https://docs.docker.com/machine/completion/
# the __docker_complete_container_names function does something like the following
# COMPREPLY=( $(compgen -W "(list of containers)" -- "$cur") )
# documentaton : http://www.tldp.org/LDP/abs/html/tabexpansion.html
View gist:770df13f1209570be024e5afa99f91ce
CLONING INTO 'LARGE-REPOSITORY'...
REMOTE: COUNTING OBJECTS: 20248, DONE.
REMOTE: COMPRESSING OBJECTS: 100% (10204/10204), DONE.
ERROR: RPC FAILED; CURL 18 TRANSFER CLOSED WITH OUTSTANDING READ DATA REMAINING
FATAL: THE REMOTE END HUNG UP UNEXPECTEDLY
FATAL: EARLY EOF
FATAL: INDEX-PACK FAILED
View keybase.md

Keybase proof

I hereby claim:

  • I am hardfire on github.
  • I am avk (https://keybase.io/avk) on keybase.
  • I have a public key whose fingerprint is CD06 A8C0 F9D7 B214 FA34 F2F3 08C9 0234 6F12 1797

To claim this, I am signing this object:

@hardfire
hardfire / 0_reuse_code.js
Created Jul 9, 2014
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
View classList.js
/* HTML Element
<div class="group awesome" id="new">Test</div>
*/
//js
var classes = document.getElementById('new').classList;
console.log(classes);
/* console output
0: group
@hardfire
hardfire / backbone-delay-context.js
Last active Dec 29, 2015
backbone delay context
View backbone-delay-context.js
_(function() {
this.trigger("awesome:event");
}).chain().bind(this).delay(500);
// Other ways of doing it in the github page
//https://github.com/jashkenas/underscore/issues/494
View dabblet.css
body{
background:#ddd;
margin:0;
font-family:arial;
font-size:44px;
font-weight:bold;
text-shadow:1px 1px 1px #aaa;
}
#bg1{
margin:200px 0px;
You can’t perform that action at this time.