Skip to content

Instantly share code, notes, and snippets.

View bergginu's full-sized avatar
🏠
Working from home

Waldemberg D. Ginú bergginu

🏠
Working from home
View GitHub Profile
##[[
cflags '-I/usr/include/tensorflow'
linklib 'tensorflow'
cinclude '<tensorflow/c/c_api.h>'
]]
global TF_AttrType: type <cimport, nodecl, using> = @enum(cint){
TF_ATTR_STRING = 0,
TF_ATTR_INT = 1,
TF_ATTR_FLOAT = 2,
TF_ATTR_BOOL = 3,
@sujinleeme
sujinleeme / README.md
Last active July 9, 2024 03:01
Get street Geojson using Openstreet's Nominaim API

Get Street Geojson using Openstreet's Nominaim API

  1. Update street names in all-streets.txt.
  2. Update your COUNTRY_CODE = 'sg' in geojson_generator.py.
  3. Run geojson_generator.py
  4. Check *.csv and geojson.json file.

Nominatim is a search engine for OpenStreetMap data. This is the debugging interface. You may search for a name or address (forward search) or look up data by its geographic coordinate (reverse search). Each result comes with a link to a details page where you can inspect what data about the object is saved in the database and investigate how the address of the object has been computed. To enhance understand of Nominatim, recommend to visit https://nominatim.openstreetmap.org/ and play for a while.

@lucaspar
lucaspar / IRRF-imposto.js
Last active January 22, 2024 16:04
Cálculo de IR em JavaScript com teste unitário.
/* Fonte: https://gist.github.com/lucaspar/2c20754b37920217678cebb64170cb7a */
/**
* Calcula o imposto de renda sobre o valor de rendimentos tributáveis,
* conforme tabela progressiva do ano tributário de 2023, seguindo a
* incidência mensal do imposto sobre a renda de pessoas físicas (IRPF).
*
* @params {Number} rendimentos Renda a ser tributada, em R$.
* @returns {Number} imposto a pagar sobre `rendimentos`, em R$.
**/
@carolosf
carolosf / talib-example.py
Created January 4, 2019 18:06
Example of how to use ta-lib to plot some financial graphs.
#%%
# Made the following example work in python 3
# https://github.com/mellertson/talib-macd-example/blob/master/talib-macd-matplotlib-example.py
#
# To get it working do the following:
# use anaconda 3 https://www.anaconda.com/download/#linux
# if using manjaro linux install TA-lib from the package manager otherwise lookup instructions on how to install TA-lib on your system
# cd ~/anaconda3/bin; ./pip install pandas_datareader
# cd ~/anaconda3/bin; ./pip install TA-Lib
# cd ~/anaconda3/bin; ./pip install https://github.com/matplotlib/mpl_finance/archive/master.zip
@ril3y
ril3y / xor_strings.js
Created January 31, 2018 03:32
Simple Javascript String XOR utility
var xor_str = function(s,K)
{
c = '';
for(i=0; i<str.length; i++) {
for(ik=0; ik<K.length; ik++){
c += String.fromCharCode(str[i].charCodeAt(0).toString(10) ^ key.charCodeAt(0).toString(10)); // XORing with letter 'K'
}
}
return c;
}
@RichardBray
RichardBray / gulp-to-webpack.md
Last active November 3, 2022 18:51
Moving from Gulp to Webpack

Moving from Gulp to webpack

I've been avoiding learning Webpack for a while now as I never thought I needed to learn another build tool, Gulp does everything I'd ever need from a build tool now or in the future. However, ever since we've moved from AngularJS to Angular (or Angular 2+) as well as introducing standards such as; TypeScript instead of Javascript and a Jasmine/Karma combo for UI testing, but also Webpack as an initial build tool. I've avoided it for long enough and now, in September 2017, I thought it's time to finally move on from my old friend Gulp.

Good Old Gulpfile

If you've never heard of Gulp before, this isn't the post to learn, there are plenty of good tutorials out there a Google search away. Then again, you don't really need to know Gulp to understand what's going on so feel free to continue reading nevertheless.

[Here's wh

# This script work on any system using systemd as the init process.
# It works on Debian/Raspbian Jessie.
# If you have Debian/Rapbian Wheezy and want to use this script with systemd
# follow the information here : https://wiki.debian.org/systemd
# To easily download, install and set at startup:
# wget -O /tmp/download https://gist.github.com/Belphemur/3f6d3bf211b0e8a18d93/download && sudo tar -zxf /tmp/download --strip-components 1 -C /etc/systemd/system/ && sudo systemctl --reload-daemon && sudo systemctl enable Node-RED
# To consult the log : journalctl -u Node-RED
[Unit]
@davidbgk
davidbgk / server.py
Created October 25, 2011 01:37
A very simple HTTP server in Python using wsgiref.simple_server
from cgi import parse_qs
from wsgiref.simple_server import make_server
def simple_app(environ, start_response):
status = '200 OK'
headers = [('Content-Type', 'text/plain')]
start_response(status, headers)
if environ['REQUEST_METHOD'] == 'POST':
request_body_size = int(environ.get('CONTENT_LENGTH', 0))
request_body = environ['wsgi.input'].read(request_body_size)