Skip to content

Instantly share code, notes, and snippets.

View kashif's full-sized avatar

Kashif Rasul kashif

  • Berlin, Germany
  • 23:18 (UTC +02:00)
  • X @krasul
View GitHub Profile
@kashif
kashif / gdal.rb
Created July 21, 2010 13:10 — forked from sabman/gdal.rb
require 'formula'
class Gdal <Formula
url 'http://download.osgeo.org/gdal/gdal-1.7.2.tar.gz'
homepage 'http://www.gdal.org/'
md5 '05351f8cb61761ae579667e24a297fe6'
def options
[
['--with-pg', "Include PostgreSQL support."],
@kashif
kashif / mk_postgis_template.sh
Created November 7, 2010 16:16
make a postgis template
# Set postgis-1.5 path.
$ POSTGIS_SQL_PATH=`pg_config --sharedir`/contrib/postgis-1.5
# Creating the template spatial database
$ createdb -E UTF8 -T template0 template_postgis
# and add PLPGSQL language support.
$ createlang -d template_postgis plpgsql
# Loading the PostGIS SQL routines.
$ psql -d template_postgis -f $POSTGIS_SQL_PATH/postgis.sql
@kashif
kashif / ubuntu-11.10-gems.erb
Created October 10, 2011 11:58 — forked from bensie/chef_bootstrap_rvm.erb
Chef bootstrap With rvm and ruby 1.9.3 on ubuntu 11.10
bash -c '
<% if knife_config[:bootstrap_proxy] -%>
(
cat <<'EOP'
<%= "proxy = #{knife_config[:bootstrap_proxy]}" %>
EOP
) > ~/.curlrc
<% end -%>
if [ ! -f /usr/bin/chef-client ]; then
@kashif
kashif / hs_2json.sql
Created January 31, 2012 10:10
Another hstore to JSON function by Andrew Dunstan
create or replace function hs_2json(hs hstore) returns text language sql
as $f$
select '{' || array_to_string(array_agg(
'"' || regexp_replace(key,E'[\\"]',E'\\\&','g') || '":' ||
case
when value is null then 'null'
when value ~ '^(true|false|(-?(0|[1-9]\d*)(\.\d+)?([eE][+-]?\d+)?))$' then value
else '"' || regexp_replace(value,E'[\\"]',E'\\\&','g') || '"'
end
# coding=utf-8
# Copyright 2023 The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
from collections import defaultdict
import numpy as np
import pandas as pd
from rich.console import Console
from rich.table import Table
import torch
import torch.nn as nn