Skip to content

Instantly share code, notes, and snippets.

View hardfire's full-sized avatar
🥑
avoca-do-ing

अभिनाश (Avinash) hardfire

🥑
avoca-do-ing
View GitHub Profile
@hardfire
hardfire / .bashrc
Created April 9, 2017 05:40
HOWTO: autocompletion in a bash function/alias
# 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
@hardfire
hardfire / README.MD
Last active August 12, 2021 03:34
using cgroups to limit browser memory+cpu usage
  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 / db.sql
Created July 20, 2017 10:55
knex+bookshelf+graphql
/* 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 / eleventy_build.yml
Created May 18, 2020 06:18
Use this action to build an eleventy site and push to gh-pages
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
//@ts-nocheck
import Constants, {AppOwnership} from 'expo-constants';
import {Image} from 'react-native';
let ImageElement = Image;
function init() {
// https://docs.expo.dev/versions/latest/sdk/constants/
// AppOwnership.Expo - The experience is running inside of the Expo Go app.
if (Constants.appOwnership !== AppOwnership.Expo) {
import('react-native-fast-image').then((FastImage) => {