working on it ...

Filters

Explore Public Snippets

Sort by

Found 144k snippets matching: https

    public by fabio.nosenzo @ Amazon_AWS_Python_API  588230  5  8  -1

    Amazon S3 Aws - S3Connection object from python boto API

    This snippet is about the S3Connection object provided by python boto package for Amazon AWS API. Here the __init__ method is listed with all its variables. The AWSAuthConnection object is initialized and it handles all the data for managing requests and response from Amazon AWS service. Path: [boto/s3/connection.py] Learn more about S3Con
    import boto.utils
    from boto.connection import AWSAuthConnection
    
    class S3Connection(AWSAuthConnection):
        DefaultHost = boto.config.get('s3', 'host', 's3.amazonaws.com')
        DefaultCallingFormat = boto.config.get('s3', 'calling_format', 'boto.s3.connection.SubdomainCallingFormat')
        QueryString = 'Signature=%s&Expires=%d&AWSAccessKeyId=%s'
    
        def __init__(self, aws_access_key_id=None, aws_secret_access_key=None,
                     is_secure=True, port=None, proxy=None, proxy_port=None,
                     proxy_user=None, proxy_pass=None,
                     host=DefaultHost, debug=0, https_connection_factory=None,
                     calling_format=DefaultCallingFormat, path='/',
                     provider='aws', bucket_class=Bucket, security_token=None,
                     suppress_consec_slashes=True, anon=False,
                     validate_certs=None):
            if isinstance(calling_format, str):
                calling_format=boto.utils.find_class(calling_format)()
            self.calling_format = calling_format
            self.bucket_class = bucket_class
            self.anon = anon
            AWSAuthConnection.__init__(self, host,
                    aws_access_key_id, aws_secret_access_key,
                    is_secure, port, proxy, proxy_port, proxy_user, proxy_pass,
                    debug=debug, https_connection_factory=https_connection_factory,
                    path=path, provider=provider, security_token=security_token,
                    suppress_consec_slashes=suppress_consec_slashes,
                    validate_certs=validate_certs)

    public by RSrini  237577  43  3  0

    Installing db-sample-schema in windows (https://github.com/oracle/db-sample-schemas)

    Installing db-sample-schema in windows (https://github.com/oracle/db-sample-schemas): db-sample-schemas
    https://github.com/oracle/db-sample-schemas
    
    download the zip file and extract to "D:\app\rsrini7\product\12.1.0\dbhome_1\demo\schema"
    
    here rsrini7 is my username. extract the zip file to the dir according to your installation.
    
    open command prompt as administrator
    d: enter
    cd D:\app\rsrini7\product\12.1.0\dbhome_1\demo\schema
    
    mkdir log
    
    perl -p -i.bak -e 's#__SUB__CWD__#'D:/app/rsrini7/product/12.1.0/dbhome_1/demo/schema/'#g' *.sql */*.sql */*.dat
    
    (to install perl and other unix related tools - install babun - rocking tool for windows users. i love this )
    
    edit mksample.sql and all '_main.sql' files and follow the below instructions
    
    this is required : http://www.dba-oracle.com/t_ora_65096_create_user_12c_without_c_prefix.htm
    
    1. in connect statement 
    	add at the end 'as sysdba'
    2. after the connect statement add the below line
    	alter session set "_oracle_script"=true;
    
    type in the command prompt : sqlplus enter
    connect oracle with sys as sysdba and enter
    type the dba-password 
    
    At final execute the below script from sql prompt
    	
    @?/demo/schema/mksample <dba-password> <dba-password> password password password password password password EXAMPLE TEMP D:/app/rsrini7/product/12.1.0/dbhome_1/demo/schema/log/
    
    replace <dba-password> with the actual dba password
    
    happy learning:)
    
    

    public by teslamint  234876  1  4  0

    modified version of coova-chilli patch for OpenWrt. This patch re-add firewall rules when reload firewall. https://lists.openwrt.org/pipermail/openwrt-devel/2012-December/018075.html

    modified version of coova-chilli patch for OpenWrt. This patch re-add firewall rules when reload firewall. https://lists.openwrt.org/pipermail/openwrt-devel/2012-December/018075.html: coova-1.3.0-custom.patch
    Index: files/chilli.init
    ===================================================================
    --- files/chilli.init   (리비전 0)
    +++ files/chilli.init   (리비전 0)
    @@ -0,0 +1,61 @@
    +#!/bin/sh /etc/rc.common
    +
    +START=30
    +STOP=90
    +
    +config_cb() {
    +    chilli_inst=$2
    +    if [ "$chilli_inst" != "" ]
    +    then
    +       rm -f /var/run/chilli_${chilli_inst}*
    +       chilli_conf=/var/run/chilli_${chilli_inst}.conf
    +       eval "start_chilli_$chilli_inst=1"
    +    fi
    +}
    +
    +option_cb() {
    +    case "$1" in
    +        # UCI settings
    +       network)
    +           . /lib/functions/network.sh
    +           local ifname
    +           network_get_device ifname $2
    +           echo "dhcpif=\"$ifname\"" >> $chilli_conf
    +           ;;
    +       disabled)
    +           eval "start_chilli_$chilli_inst=0"
    +           ;;
    +        # boolean settings
    +       dhcpbroadcast|nodynip|vlanlocation|locationstopstart|locationcopycalled|locationimmediateupdate|locationopt82|coanoipcheck|noradallow|proxymacaccept|proxyonacct|dhcpmacset|dhcpradius|noc2c|eapolenable|uamanydns|uamanyip|uamnatanyip|nouamsuccess|nowispr1|nowispr2|domaindnslocal|radsec|macauth|macreauth|macauthdeny|macallowlocal|strictmacauth|strictdhcp|ieee8021q|only8021q|radiusoriginalurl|swapoctets|statusfilesave|wpaguests|openidauth|papalwaysok|mschapv2|chillixml|acctupdate|dnsparanoia|seskeepalive|usetap|noarpentries|framedservice|scalewin|redir|injectwispr|redirurl|routeonetone|nousergardendata|uamgardendata|uamotherdata|withunixipc|uamallowpost|redirssl|uamuissl|layer3|patricia|redirdnsreq|dhcpnotidle|ipv6|ipv6only)
    +           [ "$2" = "true" -o "$2" = "1" ] && echo "$1" >> $chilli_conf
    +           ;;
    +       *)
    +           echo "$1=\"$2\"" >> $chilli_conf
    +           ;;
    +    esac
    +}
    +
    +start_chilli() {
    +    local cfg="$1"
    +    local start_chilli=$(eval "echo \$start_chilli_$cfg")
    +    [ "$start_chilli" = "0" ] && return
    +    local base=/var/run/chilli_${cfg}
    +    chilli -c ${base}.conf \
    +       --pidfile ${base}.pid \
    +       --cmdsocket ${base}.sock \
    +       --unixipc ${base}.ipc &
    +}
    +
    +start() {
    +    config_load chilli
    +    config_foreach start_chilli chilli
    +}
    +
    +stop() {
    +    ls /var/run/chilli*.pid 2>/dev/null && {
    +       kill $(cat /var/run/chilli*.pid)
    +       sleep 1
    +       killall -9 chilli &
    +       rm -f /var/run/chilli*
    +    }
    +}
    Index: files/chilli.firewall
    ===================================================================
    --- files/chilli.firewall       (리비전 0)
    +++ files/chilli.firewall       (리비전 0)
    @@ -0,0 +1,33 @@
    +#!/bin/sh
    +
    +chilli_firewall() {
    +    local cfg="$1"
    +    local tun ipup addr mask net dhcpif uamport uamuiport
    +
    +    config_get tun "$cfg" tundev
    +    config_get ipup "$cfg" ipup
    +    config_get addr "$cfg" uamlisten
    +    config_get net "$cfg" net
    +    config_get dhcpif "$cfg" dhcpif
    +    config_get uamport "$cfg" uamport
    +    config_get uamuiport "$cfg" uamuiport
    +
    +    if [ -f /var/run/chilli.$tun.sh ]; then
    +        [ "$(iptables -t filter -vL | grep $tun)" != "" ] && . /var/run/chilli.$tun.sh
    +        DEV=$tun
    +        ADDR=$addr
    +        MASK=255.255.255.0
    +        NET=$net
    +        DHCPIF=$dhcpif
    +        UAMPORT=$uamport
    +        UAMUIPORT=$uamuiport
    +        . $ipup
    +    fi
    +
    +}
    +
    +chilli_post_core_cb() {
    +    config_load chilli
    +    config_foreach chilli_firewall chilli
    +}
    +
    Index: Makefile
    ===================================================================
    --- Makefile    (리비전 37020)
    +++ Makefile    (작업 사본)
    @@ -8,16 +8,13 @@
     include $(TOPDIR)/rules.mk
    
     PKG_NAME:=coova-chilli
    -PKG_VERSION:=1.2.9
    +PKG_VERSION:=1.3.0
     PKG_RELEASE:=1
    
     PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
    -PKG_SOURCE_URL:=http://ap.coova.org/chilli
    -PKG_MD5SUM:=a493d0562fc3b05fe86d8ad65f7f2dc0
    +PKG_SOURCE_URL:=http://coova-chilli.s3.amazonaws.com/
    +PKG_MD5SUM:=dc0037e3cdebcb60508081b4e42e984a
    
    -PKG_FIXUP:=autoreconf
    -PKG_INSTALL:=1
    -
     include $(INCLUDE_DIR)/package.mk
    
     define Package/coova-chilli
    @@ -25,33 +22,102 @@
       SECTION:=net
       CATEGORY:=Network
       DEPENDS:=+kmod-tun +librt
    -  TITLE:=Wireless LAN HotSpot controller (Coova Chilli Version)
    -  URL:=http://www.coova.org/CoovaChilli
    +  TITLE:=Wireless LAN HotSpot controller
    +  URL:=http://www.coova.org/
     endef
    
    +define Package/coova-chilli-miniportal
    +  SUBMENU:=Captive Portals
    +  SECTION:=net
    +  CATEGORY:=Network
    +  DEPENDS:=+coova-chilli
    +  TITLE:=CoovaChilli MiniPortal
    +  URL:=http://www.coova.org/
    +endef
    +
     define Package/coova-chilli/description
            CoovaChilli is an open source access controller for wireless LAN
            access points and is based on ChilliSpot. It is used for authenticating
            users of a wireless (or wired) LAN. It supports web based login (UAM)
    -       which is today's standard for public HotSpots and it supports Wireless
    -       Protected Access (WPA) which is the standard of the future.
    -       Authentication, authorization and accounting (AAA) is handled by your
    -       favorite radius server.
    +       which is today's standard for public HotSpots and it supports Wireless Protected
    +       Access (WPA) which is the standard of the future. Authentication,
    +       authorization and accounting (AAA) is handled by your favorite
    +       radius server.
     endef
    
    -define Package/coova-chilli/conffiles
    -/etc/chilli.conf
    +define Build/Configure
    +  (cd $(PKG_BUILD_DIR); rm -rf config.{cache,status} ; \
    +               $(TARGET_CONFIGURE_OPTS) \
    +                CFLAGS="$(strip $(TARGET_CFLAGS)) -DNEED_DN_SKIPNAME" \
    +                CPPFLAGS="-I$(STAGING_DIR)/usr/include -I$(STAGING_DIR)/include" \
    +                LDFLAGS="-L$(STAGING_DIR)/usr/lib -L$(STAGING_DIR)/lib" \
    +               ac_cv_func_malloc_0_nonnull=yes \
    +               ac_cv_func_realloc_0_nonnull=yes \
    +               ac_cv_func_memcmp_working=yes \
    +               ac_cv_func_setvbuf_reversed=no \
    +                ./configure \
    +                       --target=$(GNU_TARGET_NAME) \
    +                       --host=$(GNU_TARGET_NAME) \
    +                       --build=$(GNU_HOST_NAME) \
    +                       --program-prefix="" \
    +                       --program-suffix="" \
    +                       --prefix=/usr \
    +                       --sysconfdir=/etc \
    +                       --exec-prefix=/usr \
    +                       --bindir=/usr/bin \
    +                       --datadir=/usr/share \
    +                       --includedir=/usr/include \
    +                       --infodir=/usr/share/info \
    +                       --libdir=/usr/lib \
    +                       --libexecdir=/usr/lib \
    +                       --localstatedir=/var \
    +                       --mandir=/usr/share/man \
    +                       --sbindir=/usr/sbin \
    +                       --enable-shared \
    +                       --disable-static \
    +                       --with-gnu-ld \
    +                       --enable-miniconfig \
    +                       --enable-miniportal \
    +                       --enable-chilliredir \
    +                       --enable-chilliproxy \
    +                       --enable-binstatusfile \
    +        );
     endef
    
    +define Build/Compile
    +       $(MAKE) -C $(PKG_BUILD_DIR) \
    +               DESTDIR="$(PKG_INSTALL_DIR)" \
    +               all install
    +endef
    +
    +define Build/InstallDev
    +       $(INSTALL_DIR) $(1)/usr/include
    +       $(CP) $(PKG_INSTALL_DIR)/usr/include/* $(1)/usr/include/
    +       $(INSTALL_DIR) $(1)/usr/lib
    +       $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib* $(1)/usr/lib/
    +endef
    +
    +
    +define Package/coova-chilli-miniportal/install
    +       $(INSTALL_DIR) $(1)/etc/chilli
    +       $(CP) $(PKG_INSTALL_DIR)/etc/chilli/www $(1)/etc/chilli/
    +endef
    +
     define Package/coova-chilli/install
    -       $(INSTALL_DIR) $(1)/etc
    -       $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/chilli.conf $(1)/etc/
    -       $(INSTALL_DIR) $(1)/etc/chilli
    -       $(CP) $(PKG_INSTALL_DIR)/etc/chilli/* $(1)/etc/chilli/
    +       $(INSTALL_DIR) $(1)/etc/chilli
    +       $(CP) $(PKG_INSTALL_DIR)/etc/chilli.conf $(1)/etc/
    +       $(CP) $(PKG_INSTALL_DIR)/etc/chilli/up.sh $(1)/etc/chilli/
    +       $(CP) $(PKG_INSTALL_DIR)/etc/chilli/down.sh $(1)/etc/chilli/
    +       $(CP) $(PKG_INSTALL_DIR)/etc/chilli/wwwsh $(1)/etc/chilli/
    +       $(INSTALL_DIR) $(1)/etc/init.d
    +       $(CP) files/chilli.init $(1)/etc/init.d/chilli
    +       $(INSTALL_DIR) $(1)/lib/firewall
    +       $(CP) files/chilli.firewall $(1)/lib/firewall/chilli.sh
            $(INSTALL_DIR) $(1)/usr/sbin
    -       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/chilli* $(1)/usr/sbin/
    +       $(CP) $(PKG_INSTALL_DIR)/usr/sbin/chilli* $(1)/usr/sbin/
            $(INSTALL_DIR) $(1)/usr/lib/
            $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib*.so.* $(1)/usr/lib/
     endef
    
     $(eval $(call BuildPackage,coova-chilli))
    +$(eval $(call BuildPackage,coova-chilli-miniportal))
    
    

    public by Fabax  232103  0  4  0

    From https://gist.github.com/anonymous/7186832

    From https://gist.github.com/anonymous/7186832: hexagone.java
    void setup() {
      size(500, 500);
      noFill();
      strokeWeight(3);
      strokeJoin(BEVEL);
    }
     
    float th1, th2, r, x, y, t;
    int N = 16;
     
    void draw() {
      background(0);
      t = map(frameCount, 0, 48, 0, TWO_PI);
      stroke(255);
      beginShape();
      for (int i=0; i<N; i++) {
        th1 = map(i, 0, N, 0, 3*TWO_PI);
        th2 = map(i, 0, N, 0, 2*TWO_PI);
        r = map(sin(t+th2), -1, 1, 140, 180);
        x = width/2 + r*cos(th1);
        y = height/2 + r*sin(th1);
        vertex(x, y);
      }
      endShape(CLOSE);
    }
    
    

    public by zer00ne  230379  1  6  1

    DB(store, schema) | Store Data in localStorage

    [FORK][ https://www.snip2code.com/Snippet/217248/object-data-store-----stuff-it-in-yer-cl
      // Local Data
       
    function DB(store, schema) {
          this.store = store;
          if (!localStorage[store] || typeof localStorage[store] == 'undefined') {
              localStorage[store] = JSON.stringify(schema|| {});
          }
          this.setData = function (key, val) {
              var lda = JSON.parse(localStorage[this.store]);
              doUpdate(ldta, key, val);
              localStorage[store] = JSON.stringify(ldta);
          };
          this.getData = function (key) {
              var ldta = JSON.parse(localStorage[this.store]);
              if (key) {
                  return pathGet(ldta, key);
              }
              return ldta;
          };
          this.reset = function (schema) {
              localStorage[this.store] = JSON.stringify(schema || {});
          };
          this.delete = function() {
              localStorage.removeItem(this.store);
          };
          var doUpdate = function (ob, kStr, val) {
              var kpth = keyStr.split('.'),
              i = 0, lstIdx = kpth.length - 1;
              for (;i < lstIdx; ++i) {
                  var key = kpth[i];
                  if (!(key in ob)) {
                      ob[key] = {};
                  }
                  ob = ob[key];
              }
              ob[kpth[lstIdx]] = val;
          };
          var pathGet = function (obj, key, leftOvrs) {
              if ( leftOvrs === undefined ) {
                  leftOvrs = key.split('.');
              }
              var cur = leftOvrs.shift();
              if ( typeof(obj) == 'object' && obj[cur] !== undefined ) {
                  if ( leftOvrs.length === 0 ) {
                      return obj[cur];
                  }
                  else if ( typeof(obj[cur]) == 'object' ) {
                      return arguments.callee(obj[cur], undefined, leftOvrs);
                  }
              }
              return null;
          };
      }
                            

    public by lbottaro  172551  10  6  0

    curl to send a GET HTTP request with query parameters

    Try to perform a GET HTTP to snip2code server, to list the public snippets in Channels. URL example to get: https://www.snip2code.com/Explore/InChannel?q=test&sort=0&direction=1 Options: -d: list all query parameters -G: perform GET verb
    curl -v -L -G -d "q=test&sort=0&direction=1" https://www.snip2code.com/Explore/InChannel                               

    public by mr-linch  137810  0  3  0

    Исходный код для урока (https://youtu.be/KPXPr-KS-qk)

    Исходный код для урока (https://youtu.be/KPXPr-KS-qk): weblancer.py
    #!/usr/bin/env python3
    
    import csv
    import urllib.request
    
    from bs4 import BeautifulSoup
    
    
    BASE_URL = 'http://www.weblancer.net/projects/'
    
    
    def get_html(url):
        response = urllib.request.urlopen(BASE_URL)
        return response.read()
    
    
    def get_page_count(html):
        soup = BeautifulSoup(html)
        paggination = soup.find('div', class_='pages_list text_box')
        return int(paggination.find_all('a')[-2].text)
    
    
    def parse(html):
        soup = BeautifulSoup(html)
        table = soup.find('table', class_='items_list')
        rows = table.find_all('tr')[1:]
    
        projects = []
        for row in rows:
    
            cols = row.find_all('td')
    
            projects.append({
                'title': cols[0].a.text,
                'categories': [category.text for category in cols[0].find_all('noindex')],
                'price': cols[1].text.strip().split()[0],
                'application': cols[2].text.split()[0]
            })
    
        return projects
    
    def save(projects, path):
        with open(path, 'w') as csvfile:
            writer = csv.writer(csvfile)
    
            writer.writerow(('Проект', 'Категории', 'Цена', 'Заявки'))
    
            writer.writerows(
                (project['title'], ', '.join(project['categories']), project['price'], project['application']) for project in projects
            )
    
    def main():
        total_pages = get_page_count(get_html(BASE_URL))
    
        print('Всего найдено %d страниц...' % total_pages)
    
        projects = []
    
        for page in range(1, total_pages + 1):
            print('Парсинг %d%% (%d/%d)' % (page / total_pages * 100, page, total_pages))
            projects.extend(parse(get_html(BASE_URL + "page=%d" % page)))
    
        print('Сохранение...')
        save(projects, 'projects.csv')
    
    
    if __name__ == '__main__':
        main()
    
    

    public by Geometry  87824  2  4  0

    PubKeyToScript: For POS coins - used to format wallet address pubkey to use in generation transaction's output.

    For POS coins - used to format wallet address pubkey to use in generation transaction's output. nodejs: https://github.com/zone117x/node-stratum-pool/blob/3586ec0d7374b2acc5a72d5ef597da26f0e39d54/lib/util.js#L243 nodejs: http://runnable.com/me/VCFHE0RrZnwbsQ6y
    using System;
    using System.IO;
    using System.Linq;
    using CoiniumServ.Coin.Address;
    using CoiniumServ.Coin.Address.Exceptions;
    using CoiniumServ.Cryptology;
    using CoiniumServ.Utils.Extensions;
    using CoiniumServ.Utils.Numerics;
    using Gibbed.IO;
    using Serilog;
    
    /// <summary>
    /// For POS coins - used to format wallet address pubkey to use in generation transaction's output.
    /// </summary>
    /// <param name="key"></param>
    /// <example>
    /// nodejs: https://github.com/zone117x/node-stratum-pool/blob/3586ec0d7374b2acc5a72d5ef597da26f0e39d54/lib/util.js#L243
    /// nodejs: http://runnable.com/me/VCFHE0RrZnwbsQ6y
    /// </example>
    /// <returns></returns>
    public static byte[] PubKeyToScript(string key)
    {
        var pubKey = key.HexToByteArray();
    
        if (pubKey.Length != 33)
        {
            Log.Error("invalid pubkey length for {0:l}", key);
            return null;
        }
    
        byte[] result;
    
        using (var stream = new MemoryStream())
        {
            stream.WriteValueU8(0x21);
            stream.WriteBytes(pubKey);
            stream.WriteValueU8(0xac);
            result = stream.ToArray();
        }
    
        return result;
    }

    public by Github  76046  0  3  0

    Created using browser-solidity: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://chriseth.github.io/browser-solidity/#version=soljson-latest.js&optimize=undefined&gist=

    Created using browser-solidity: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://chriseth.github.io/browser-solidity/#version=soljson-latest.js&optimize=undefined&gist=: Untitled
    contract Ballot {
    
        struct Voter {
            uint weight;
            bool voted;
            uint8 vote;
            address delegate;
        }
        struct Proposal {
            uint voteCount;
        }
    
        address chairperson;
        mapping(address => Voter) voters;
        Proposal[] proposals;
    
        // Create a new ballot with $(_numProposals) different proposals.
        function Ballot(uint8 _numProposals) {
            chairperson = msg.sender;
            voters[chairperson].weight = 1;
            proposals.length = _numProposals;
        }
    
        // Give $(voter) the right to vote on this ballot.
        // May only be called by $(chairperson).
        function giveRightToVote(address voter) {
            if (msg.sender != chairperson || voters[voter].voted) return;
            voters[voter].weight = 1;
        }
    
        // Delegate your vote to the voter $(to).
        function delegate(address to) {
            Voter sender = voters[msg.sender]; // assigns reference
            if (sender.voted) return;
            while (voters[to].delegate != address(0) && voters[to].delegate != msg.sender)
                to = voters[to].delegate;
            if (to == msg.sender) return;
            sender.voted = true;
            sender.delegate = to;
            Voter delegate = voters[to];
            if (delegate.voted)
                proposals[delegate.vote].voteCount += sender.weight;
            else
                delegate.weight += sender.weight;
        }
    
        // Give a single vote to proposal $(proposal).
        function vote(uint8 proposal) {
            Voter sender = voters[msg.sender];
            if (sender.voted || proposal >= proposals.length) return;
            sender.voted = true;
            sender.vote = proposal;
            proposals[proposal].voteCount += sender.weight;
        }
    
        function winningProposal() constant returns (uint8 winningProposal) {
            uint256 winningVoteCount = 0;
            for (uint8 proposal = 0; proposal < proposals.length; proposal++)
                if (proposals[proposal].voteCount > winningVoteCount) {
                    winningVoteCount = proposals[proposal].voteCount;
                    winningProposal = proposal;
                }
        }
    }
    
    
    

    public by micurs  39065  458  10  8

    Using crypto-js in node.js with Typescript

    You can easily install the crypto-js library in node by using the command (on Mac): npm install crypto-js After that you need to download its type definition from Git/DefinitelyTyped: https://github.com/borisyankov/DefinitelyTyped/tree/master/cryptojs To make it work, however you need to add the following to the cryptojs.d.ts:
    // add this at the end of crypto.d.ts
      declare module "crypto-js" {
        export = CryptoJS;
      }
    
    // Then you can use the module in typescript
    
    ///<reference path='../types/node.d.ts'/>
    ///<reference path='../types/cryptojs.d.ts'/>
    
    import crypto = require("crypto-js");  
    
    function writeln( msg: string ) {
      process.stdout.write( msg +'\n');
    }
    
    var message : string = "Hello Encrypted World!";
    var cmessage : string = crypto.HmacSHA1( message , "1234").toString();
    writeln( message );
    writeln( cmessage );
    
    • Public Snippets
    • Channels Snippets