Skip to content

Instantly share code, notes, and snippets.

View Manoj-nathwani's full-sized avatar

Manoj Nathwani Manoj-nathwani

View GitHub Profile
@Manoj-nathwani
Manoj-nathwani / README.md
Last active April 14, 2022 11:55
Datopian Data Explorer
@Manoj-nathwani
Manoj-nathwani / README.md
Created March 17, 2022 15:45
CKAN Theming guide

CKAN Theming guide

  1. Edit the existing bootstrap-variables.less and variables.less files from /home/ubuntu/fjelltopp/dms/ckan/ckan/public/base/less. For an example, see the attached two files on this gist

  2. Then compile the less into css

$ lessc \
    /home/ubuntu/fjelltopp/dms/ckan/ckan/public/base/less/main.less \
    /home/ubuntu/fjelltopp/dms/ckanext-dms/ckanext/dms/assets/css/dms-main.css
@Manoj-nathwani
Manoj-nathwani / index.js
Created March 24, 2021 14:28
BulkFileUploaderComponent
import ReactDOM from 'react-dom';
import React from 'react';
import App from './src/App';
const componentElement =
document.getElementById('BulkFileUploaderComponent');
const getAttr = key => {
const val = componentElement.getAttribute(`data-${key}`);
return ['None', ''].includes(val) ? null : val;
};
@Manoj-nathwani
Manoj-nathwani / _UNAIDS_UI_TESTS.md
Last active March 3, 2021 17:28
UNAIDS UI Tests

UNAIDS UI Tests

An early stage script testing how we could implement silenium UI tests with UNAIDS

Setup

  • Save the script somewhere
  • Save the chromedriver and a example.csv file in the same directory
  • Edit global variables accordingly

Done

  • Uploading a link resource
@Manoj-nathwani
Manoj-nathwani / resource_extras.html
Last active December 8, 2020 14:51
git diff of resource_extras.html
{% macro dataset_link(id, name) -%}
<a href="{{h.url_for(controller='dataset', action='read', id=id)}}">{{name}}</a>
{%- endmacro %}
{% macro resource_link(dataset_id, resource_id, resource_name) -%}
{% set resource_url = h.url_for(
qualified=True,
controller='resource',
action='read',
id=dataset_id,
@Manoj-nathwani
Manoj-nathwani / README.md
Last active September 14, 2019 21:54
Microbit Lamp

Wiring

  • Microbit USB -> laptop or power source
  • Microbit pin0 -> Arduino RX
  • Microbit GND -> Common -
  • Microbit 5V -> Common +
  • Arduino VCC -> Common +
  • Arduino GND -> Common -
  • Arduino pin8 -> Neopixel din
  • Neopixel 5v -> Common +
@Manoj-nathwani
Manoj-nathwani / pizero_blinkytape.md
Created August 27, 2019 10:01
Pi Zero + blinkytape
@Manoj-nathwani
Manoj-nathwani / arduino.h
Created August 22, 2019 10:19
FastLED + DmxSimple
#include <DmxSimple.h>
#include <FastLED.h>
// How many leds in your strip?
#define NUM_LEDS 12
// For led chips like Neopixels, which have a data line, ground, and power, you just
// need to define DATA_PIN. For led chipsets that are SPI based (four wires - data, clock,
// ground, and power), like the LPD8806 define both DATA_PIN and CLOCK_PIN
#define DATA_PIN 8
@Manoj-nathwani
Manoj-nathwani / remove_flickr.md
Last active July 31, 2019 02:27
Update Jekyll blog to self hostings images

Problem

  • My Jekyll blog uses hundrads of images on flickr for free image hosting
  • buuuuuuuut it's 2019 now and flickr is no longer free 🙈

Solution

  • Download all images hosted on flickr and save them to /images/articles/
  • Replace all image src attributes to using the new image location
@Manoj-nathwani
Manoj-nathwani / script.py
Created January 30, 2019 15:57
id,city,country ---> id,lat,lon
# -*- coding: utf-8 -*-
import csv, os, time
from geopy.geocoders import Nominatim
THIS_FOLDER = os.path.dirname(os.path.abspath(__file__))
my_file = os.path.join(THIS_FOLDER, 'data.csv')
geolocator = Nominatim()