Skip to content

Instantly share code, notes, and snippets.

@debloper
debloper / script.sh
Last active May 18, 2020
Initialize a simple cassandra cluster
View script.sh
$ cqlsh
Connected to Test Cluster at 127.0.0.1:9042.
[cqlsh 5.0.1 | Cassandra 3.11.6 | CQL spec 3.4.4 | Native protocol v4]
Use HELP for help.
cqlsh> CREATE KEYSPACE foo WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1};
cqlsh> USE foo;
cqlsh:foo> CREATE TABLE foo.bar (id int PRIMARY KEY, status text, details list<text>);
cqlsh:foo> INSERT INTO bar (id, status, details) VALUES (1, 'done', ['sample text']);
@debloper
debloper / README.md
Created Feb 14, 2020
Create commits and send pull requests on GitHub from CLI with cURL
View README.md

Prerequisites

  • Personal Access <token> for <user> with all repo[...] access (may need more permissions, depending on the commit)
  • The <user> having write/push access to the existing <branch> of the intended <repo> of <org|user>
  • For creating new commits
    • The base64 encoded file content <base64content> is required.
    • To update an existing file, the <sha> hash of the file that's being replaced on GitHub repo is required

Creating Commits

Creating commits with /contents endpoint come with a limitation (as of APIv3) that it can only create/update a file. Updating multiple files (with a DIFF) doesn't seem to be possible very easily. The SHA sum is only required to update a single file with new contents, not for creating new file.

@debloper
debloper / index.html
Created Oct 23, 2019 — forked from JulesBlm/index.html
GeologicalTimescale
View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<meta http-equiv="Content-Language" content="en" />
<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no, width=device-width">
<title>Geologic Time</title>
<link rel="stylesheet" href="timescale.css" />
@debloper
debloper / docker-compose.yml
Created Oct 9, 2019
Run a ghost blog container with mounted data directory (./content) from the host
View docker-compose.yml
version: '3'
services:
ghost:
image: ghost:latest
restart: always
ports:
- 8080:2368
volumes:
@debloper
debloper / homepage.md
Last active Apr 21, 2018
Get Started with Fabric8 Planner
View homepage.md
  • Head over to Fabric8 Planner Repo on GitHub
  • Fork the repo, then clone the repo locally and switch to gh-pages branch
  • Use any static file-server (for e.g. python SimpleHTTPServer or npm http-server) to serve the content
  • Open the URL in your favorite modern browser (usually http://localhost:8080 or http://localhost:3000)
  • You should see the landing page like http://fabric8-ui.github.io/fabric8-planner/

  • If everything is good till now, then you're ready to make changes to the source
  • Maintain good commitiquettes to add new changes, and push them to your fork
@debloper
debloper / docker-compose.yml
Last active Oct 4, 2017
Fabric8 Planner Stack
View docker-compose.yml
version: '3'
services:
planner:
build: .
container_name: fabric8-planner-runtime
image: fabric8-planner-runtime
# command: npm run test:unit
environment:
FABRIC8_WIT_API_URL: http://localhost:8080/api/
@debloper
debloper / readme.md
Last active Aug 9, 2018
URL scheme customization for a Ghost blog
View readme.md

Quick steps to change URL scheme in a self-deployed Ghose blog:

  • Open DB in CLI: # sqlite3 content/data/ghost.db
  • Set the UX properties (optional): sqlite> .headers ON & sqlite> .mode column
  • Check the settings table (look for key "permalinks"): sqlite> SELECT * FROM settings;
  • Change the URL scheme: sqlite> update settings set value = '/:id/' where key = 'permalinks';
  • Quit database (sqlite> .quit) & restart ghost server

N.B: year, month, day, slug, id etc are valid keywords for configuring the URL (let me know if I've missed any).
Statutory Warning: if you're using different database, the steps are similar, but the commands will differ to achieve the same purpose. Also, I'm not to be blamed if you broke your thing while trying this out.

@debloper
debloper / benderSays.rs
Created May 17, 2015
A simple switch-case/match with string output reference implementation on Rust
View benderSays.rs
use std::os;
fn main() {
let argv = &os::args();
match argv[1] {
~"biteMe" => println("\n\tBite my _Rusty_ metal ass!\n"),
~"killYa" => println("\n\tKILL ALL HUMANS!\n"),
~"letsGo" => println("\n\tLet's GO ALREADYYY...\n"),
_ => println("\n\tOh. Your. God.\n")
}
}
@debloper
debloper / timing.md
Created Mar 15, 2015
Hacking Gaia at FOSSAsia2015
View timing.md

Total Time 1:30hrs

Break ups:

  • [5min] Introduction of Gaia
    • Schematic Architecture of FxOS
    • Pick the top layer - i.e. Gaia
    • Discuss it's attributes (built with Web Technologies)
    • Briefly discuss the general overview
    • Demonstration of Mulet, WebIDE (& Flame)
  • [10min] App security/permission model
@debloper
debloper / repel.js
Last active Aug 29, 2015
Lean mouseover-on-page element animator scripts
View repel.js
// Set the element to select; the only moving part here
// Like literally...
var elem = document.querySelector("elem")
, html = document.querySelector("html");
// Apply positioning, just in case it wasn't already
elem.style.position = "absolute";
// Take the viewport height/width into consideration
// @TODO: should be updated on window resize
You can’t perform that action at this time.